diff options
Diffstat (limited to 'arch')
313 files changed, 8336 insertions, 3856 deletions
| diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c index 8873fb719..93f429cc5 100644 --- a/arch/arm/cpu/arm1136/mx31/generic.c +++ b/arch/arm/cpu/arm1136/mx31/generic.c @@ -22,6 +22,7 @@   */  #include <common.h> +#include <div64.h>  #include <asm/arch/imx-regs.h>  #include <asm/arch/clock.h>  #include <asm/io.h> @@ -30,16 +31,17 @@  static u32 mx31_decode_pll(u32 reg, u32 infreq)  {  	u32 mfi = GET_PLL_MFI(reg); -	u32 mfn = GET_PLL_MFN(reg); +	s32 mfn = GET_PLL_MFN(reg);  	u32 mfd = GET_PLL_MFD(reg);  	u32 pd =  GET_PLL_PD(reg);  	mfi = mfi <= 5 ? 5 : mfi; +	mfn = mfn >= 512 ? mfn - 1024 : mfn;  	mfd += 1;  	pd += 1; -	return ((2 * (infreq >> 10) * (mfi * mfd + mfn)) / -		(mfd * pd)) << 10; +	return lldiv(2 * (u64)infreq * (mfi * mfd + mfn), +		mfd * pd);  }  static u32 mx31_get_mpl_dpdgck_clk(void) @@ -47,9 +49,9 @@ static u32 mx31_get_mpl_dpdgck_clk(void)  	u32 infreq;  	if ((readl(CCM_CCMR) & CCMR_PRCS_MASK) == CCMR_FPM) -		infreq = CONFIG_MX31_CLK32 * 1024; +		infreq = MXC_CLK32 * 1024;  	else -		infreq = CONFIG_MX31_HCLK_FREQ; +		infreq = MXC_HCLK;  	return mx31_decode_pll(readl(CCM_MPCTL), infreq);  } diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c index 72081a8bd..36266da5a 100644 --- a/arch/arm/cpu/arm1136/mx31/timer.c +++ b/arch/arm/cpu/arm1136/mx31/timer.c @@ -23,6 +23,7 @@  #include <common.h>  #include <asm/arch/imx-regs.h> +#include <asm/arch/clock.h>  #include <div64.h>  #include <watchdog.h>  #include <asm/io.h> @@ -53,28 +54,27 @@ DECLARE_GLOBAL_DATA_PTR;  static inline unsigned long long tick_to_time(unsigned long long tick)  {  	tick *= CONFIG_SYS_HZ; -	do_div(tick, CONFIG_MX31_CLK32); +	do_div(tick, MXC_CLK32);  	return tick;  }  static inline unsigned long long time_to_tick(unsigned long long time)  { -	time *= CONFIG_MX31_CLK32; +	time *= MXC_CLK32;  	do_div(time, CONFIG_SYS_HZ);  	return time;  }  static inline unsigned long long us_to_tick(unsigned long long us)  { -	us = us * CONFIG_MX31_CLK32 + 999999; +	us = us * MXC_CLK32 + 999999;  	do_div(us, 1000000);  	return us;  }  #else  /* ~2% error */ -#define TICK_PER_TIME	((CONFIG_MX31_CLK32 + CONFIG_SYS_HZ / 2) \ -							/ CONFIG_SYS_HZ) -#define US_PER_TICK	(1000000 / CONFIG_MX31_CLK32) +#define TICK_PER_TIME	((MXC_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define US_PER_TICK	(1000000 / MXC_CLK32)  static inline unsigned long long tick_to_time(unsigned long long tick)  { @@ -128,7 +128,7 @@ ulong get_timer_masked(void)  {  	/*  	 * get_ticks() returns a long long (64 bit), it wraps in -	 * 2^64 / CONFIG_MX31_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ +	 * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~  	 * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in  	 * 5 * 10^6 days - long enough.  	 */ @@ -159,7 +159,7 @@ void __udelay(unsigned long usec)   */  ulong get_tbclk(void)  { -	return CONFIG_MX31_CLK32; +	return MXC_CLK32;  }  void reset_cpu(ulong addr) diff --git a/arch/arm/cpu/arm1136/mx35/generic.c b/arch/arm/cpu/arm1136/mx35/generic.c index 986b1f946..ef65176ee 100644 --- a/arch/arm/cpu/arm1136/mx35/generic.c +++ b/arch/arm/cpu/arm1136/mx35/generic.c @@ -24,12 +24,16 @@   */  #include <common.h> +#include <div64.h>  #include <asm/io.h>  #include <asm/errno.h>  #include <asm/arch/imx-regs.h>  #include <asm/arch/crm_regs.h>  #include <asm/arch/clock.h>  #include <asm/arch/sys_proto.h> +#ifdef CONFIG_FSL_ESDHC +#include <fsl_esdhc.h> +#endif  #include <netdev.h>  #define CLK_CODE(arm, ahb, sel) (((arm) << 16) + ((ahb) << 8) + (sel)) @@ -126,15 +130,17 @@ static int get_ahb_div(u32 pdr0)  static u32 decode_pll(u32 reg, u32 infreq)  {  	u32 mfi = (reg >> 10) & 0xf; -	u32 mfn = reg & 0x3f; -	u32 mfd = (reg >> 16) & 0x3f; +	s32 mfn = reg & 0x3ff; +	u32 mfd = (reg >> 16) & 0x3ff;  	u32 pd = (reg >> 26) & 0xf;  	mfi = mfi <= 5 ? 5 : mfi; +	mfn = mfn >= 512 ? mfn - 1024 : mfn;  	mfd += 1;  	pd += 1; -	return ((2 * (infreq / 1000) * (mfi * mfd + mfn)) / (mfd * pd)) * 1000; +	return lldiv(2 * (u64)infreq * (mfi * mfd + mfn), +		mfd * pd);  }  static u32 get_mcu_main_clk(void) @@ -143,9 +149,7 @@ static u32 get_mcu_main_clk(void)  	struct ccm_regs *ccm =  		(struct ccm_regs *)IMX_CCM_BASE;  	arm_div = get_arm_div(readl(&ccm->pdr0), &fi, &fd); -	fi *= -		decode_pll(readl(&ccm->mpctl), -			CONFIG_MX35_HCLK_FREQ); +	fi *= decode_pll(readl(&ccm->mpctl), MXC_HCLK);  	return fi / (arm_div * fd);  } @@ -168,17 +172,14 @@ static u32 get_ipg_per_clk(void)  	u32 pdr4 = readl(&ccm->pdr4);  	u32 div;  	if (pdr0 & MXC_CCM_PDR0_PER_SEL) { -		div = (CCM_GET_DIVIDER(pdr4, -			MXC_CCM_PDR4_PER0_PRDF_MASK, -			MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1) * -			(CCM_GET_DIVIDER(pdr4, +		div = CCM_GET_DIVIDER(pdr4,  			MXC_CCM_PDR4_PER0_PODF_MASK, -			MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1); +			MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1;  	} else {  		div = CCM_GET_DIVIDER(pdr0,  			MXC_CCM_PDR0_PER_PODF_MASK,  			MXC_CCM_PDR0_PER_PODF_OFFSET) + 1; -		freq /= get_ahb_div(pdr0); +		div *= get_ahb_div(pdr0);  	}  	return freq / div;  } @@ -190,25 +191,20 @@ u32 imx_get_uartclk(void)  		(struct ccm_regs *)IMX_CCM_BASE;  	u32 pdr4 = readl(&ccm->pdr4); -	if (readl(&ccm->pdr3) & MXC_CCM_PDR3_UART_M_U) { +	if (readl(&ccm->pdr3) & MXC_CCM_PDR3_UART_M_U)  		freq = get_mcu_main_clk(); -	} else { -		freq = decode_pll(readl(&ccm->ppctl), -			CONFIG_MX35_HCLK_FREQ); -	} -	freq /= ((CCM_GET_DIVIDER(pdr4, -			MXC_CCM_PDR4_UART_PRDF_MASK, -			MXC_CCM_PDR4_UART_PRDF_OFFSET) + 1) * -		(CCM_GET_DIVIDER(pdr4, +	else +		freq = decode_pll(readl(&ccm->ppctl), MXC_HCLK); +	freq /= CCM_GET_DIVIDER(pdr4,  			MXC_CCM_PDR4_UART_PODF_MASK, -			MXC_CCM_PDR4_UART_PODF_OFFSET) + 1)); +			MXC_CCM_PDR4_UART_PODF_OFFSET) + 1;  	return freq;  } -unsigned int mxc_get_main_clock(enum mxc_main_clocks clk) +unsigned int mxc_get_main_clock(enum mxc_main_clock clk)  {  	u32 nfc_pdf, hsp_podf; -	u32 pll, ret_val = 0, usb_prdf, usb_podf; +	u32 pll, ret_val = 0, usb_podf;  	struct ccm_regs *ccm =  		(struct ccm_regs *)IMX_CCM_BASE; @@ -252,16 +248,13 @@ unsigned int mxc_get_main_clock(enum mxc_main_clocks clk)  		ret_val = pll / (nfc_pdf + 1);  		break;  	case USB_CLK: -		usb_prdf = (reg4 >> 25) & 0x7; -		usb_podf = (reg4 >> 22) & 0x7; -		if (reg4 & 0x200) { +		usb_podf = (reg4 >> 22) & 0x3F; +		if (reg4 & 0x200)  			pll = get_mcu_main_clk(); -		} else { -			pll = decode_pll(readl(&ccm->ppctl), -				CONFIG_MX35_HCLK_FREQ); -		} +		else +			pll = decode_pll(readl(&ccm->ppctl), MXC_HCLK); -		ret_val = pll / ((usb_prdf + 1) * (usb_podf + 1)); +		ret_val = pll / (usb_podf + 1);  		break;  	default:  		printf("Unknown clock: %d\n", clk); @@ -270,7 +263,7 @@ unsigned int mxc_get_main_clock(enum mxc_main_clocks clk)  	return ret_val;  } -unsigned int mxc_get_peri_clock(enum mxc_peri_clocks clk) +unsigned int mxc_get_peri_clock(enum mxc_peri_clock clk)  {  	u32 ret_val = 0, pdf, pre_pdf, clk_sel;  	struct ccm_regs *ccm = @@ -284,18 +277,16 @@ unsigned int mxc_get_peri_clock(enum mxc_peri_clocks clk)  	case UART2_BAUD:  	case UART3_BAUD:  		clk_sel = mpdr3 & (1 << 14); -		pre_pdf = (mpdr4 >> 13) & 0x7; -		pdf = (mpdr4 >> 10) & 0x7; +		pdf = (mpdr4 >> 10) & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / -				((pre_pdf + 1) * (pdf + 1)); +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1);  		break;  	case SSI1_BAUD:  		pre_pdf = (mpdr2 >> 24) & 0x7;  		pdf = mpdr2 & 0x3F;  		clk_sel = mpdr2 & (1 << 6);  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) /  				((pre_pdf + 1) * (pdf + 1));  		break;  	case SSI2_BAUD: @@ -303,16 +294,14 @@ unsigned int mxc_get_peri_clock(enum mxc_peri_clocks clk)  		pdf = (mpdr2 >> 8) & 0x3F;  		clk_sel = mpdr2 & (1 << 6);  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) /  				((pre_pdf + 1) * (pdf + 1));  		break;  	case CSI_BAUD:  		clk_sel = mpdr2 & (1 << 7); -		pre_pdf = (mpdr2 >> 16) & 0x7; -		pdf = (mpdr2 >> 19) & 0x7; +		pdf = (mpdr2 >> 16) & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / -				((pre_pdf + 1) * (pdf + 1)); +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1);  		break;  	case MSHC_CLK:  		pre_pdf = readl(&ccm->pdr1); @@ -320,39 +309,33 @@ unsigned int mxc_get_peri_clock(enum mxc_peri_clocks clk)  		pdf = (pre_pdf >> 22) & 0x3F;  		pre_pdf = (pre_pdf >> 28) & 0x7;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) /  				((pre_pdf + 1) * (pdf + 1));  		break;  	case ESDHC1_CLK:  		clk_sel = mpdr3 & 0x40; -		pre_pdf = mpdr3 & 0x7; -		pdf = (mpdr3>>3) & 0x7; +		pdf = mpdr3 & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / -				((pre_pdf + 1) * (pdf + 1)); +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1);  		break;  	case ESDHC2_CLK:  		clk_sel = mpdr3 & 0x40; -		pre_pdf = (mpdr3 >> 8) & 0x7; -		pdf = (mpdr3 >> 11) & 0x7; +		pdf = (mpdr3 >> 8) & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / -				((pre_pdf + 1) * (pdf + 1)); +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1);  		break;  	case ESDHC3_CLK:  		clk_sel = mpdr3 & 0x40; -		pre_pdf = (mpdr3 >> 16) & 0x7; -		pdf = (mpdr3 >> 19) & 0x7; +		pdf = (mpdr3 >> 16) & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / -				((pre_pdf + 1) * (pdf + 1)); +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1);  		break;  	case SPDIF_CLK:  		clk_sel = mpdr3 & 0x400000;  		pre_pdf = (mpdr3 >> 29) & 0x7;  		pdf = (mpdr3 >> 23) & 0x3F;  		ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : -			decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / +			decode_pll(readl(&ccm->ppctl), MXC_HCLK)) /  				((pre_pdf + 1) * (pdf + 1));  		break;  	default: @@ -463,7 +446,6 @@ int print_cpuinfo(void)   * Initializes on-chip ethernet controllers.   * to override, implement board_eth_init()   */ -  int cpu_eth_init(bd_t *bis)  {  	int rc = -ENODEV; @@ -475,6 +457,17 @@ int cpu_eth_init(bd_t *bis)  	return rc;  } +#ifdef CONFIG_FSL_ESDHC +/* + * Initializes on-chip MMC controllers. + * to override, implement board_mmc_init() + */ +int cpu_mmc_init(bd_t *bis) +{ +	return fsl_esdhc_mmc_init(bis); +} +#endif +  int get_clocks(void)  {  #ifdef CONFIG_FSL_ESDHC diff --git a/arch/arm/cpu/arm1136/mx35/iomux.c b/arch/arm/cpu/arm1136/mx35/iomux.c index f93191dae..a302575ed 100644 --- a/arch/arm/cpu/arm1136/mx35/iomux.c +++ b/arch/arm/cpu/arm1136/mx35/iomux.c @@ -44,8 +44,6 @@ enum iomux_reg_addr {  #define MUX_INPUT_NUM_MUX	\  		(((IOMUXSW_INPUT_END - IOMUXSW_INPUT_CTL) >> 2) + 1) -#define PIN_TO_IOMUX_INDEX(pin) ((PIN_TO_IOMUX_PAD(pin) - 0x328) >> 2) -  /*   * Request ownership for an IO pin. This function has to be the first one   * being called before that pin is used. diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c index 04937a1df..9680b7fde 100644 --- a/arch/arm/cpu/arm1136/mx35/timer.c +++ b/arch/arm/cpu/arm1136/mx35/timer.c @@ -27,6 +27,7 @@  #include <asm/io.h>  #include <div64.h>  #include <asm/arch/imx-regs.h> +#include <asm/arch/crm_regs.h>  #include <asm/arch/clock.h>  DECLARE_GLOBAL_DATA_PTR; @@ -37,43 +38,52 @@ DECLARE_GLOBAL_DATA_PTR;  /* General purpose timers bitfields */  #define GPTCR_SWR       (1<<15)	/* Software reset */  #define GPTCR_FRR       (1<<9)	/* Freerun / restart */ -#define GPTCR_CLKSOURCE_32   (0x100<<6)	/* Clock source */ -#define GPTCR_CLKSOURCE_IPG (0x001<<6)	/* Clock source */ +#define GPTCR_CLKSOURCE_32   (4<<6)	/* Clock source */  #define GPTCR_TEN       (1)	/* Timer enable */ -#define	TIMER_FREQ_HZ	mxc_get_clock(MXC_IPG_CLK) - +/* + * "time" is measured in 1 / CONFIG_SYS_HZ seconds, + * "tick" is internal timer period + */ +/* ~0.4% error - measured with stop-watch on 100s boot-delay */  static inline unsigned long long tick_to_time(unsigned long long tick)  {  	tick *= CONFIG_SYS_HZ; -	do_div(tick, TIMER_FREQ_HZ); +	do_div(tick, MXC_CLK32);  	return tick;  } -static inline unsigned long long us_to_tick(unsigned long long usec) +static inline unsigned long long us_to_tick(unsigned long long us)  { -	usec *= TIMER_FREQ_HZ; -	do_div(usec, 1000000); +	us = us * MXC_CLK32 + 999999; +	do_div(us, 1000000); -	return usec; +	return us;  } +/* + * nothing really to do with interrupts, just starts up a counter. + * The 32KHz 32-bit timer overruns in 134217 seconds + */  int timer_init(void)  {  	int i;  	struct gpt_regs *gpt = (struct gpt_regs *)GPT1_BASE_ADDR; +	struct ccm_regs *ccm = (struct ccm_regs *)CCM_BASE_ADDR;  	/* setup GP Timer 1 */  	writel(GPTCR_SWR, &gpt->ctrl); -	for (i = 0; i < 100; i++) -		writel(0, &gpt->ctrl);	/* We have no udelay by now */ -	writel(0, &gpt->pre); -	/* Freerun Mode, PERCLK1 input */ -	writel(readl(&gpt->ctrl) | -		GPTCR_CLKSOURCE_IPG | GPTCR_TEN, -		&gpt->ctrl); +	writel(readl(&ccm->cgr1) | 3 << MXC_CCM_CGR1_GPT_OFFSET, &ccm->cgr1); + +	for (i = 0; i < 100; i++) +		writel(0, &gpt->ctrl); /* We have no udelay by now */ +	writel(0, &gpt->pre); /* prescaler = 1 */ +	/* Freerun Mode, 32KHz input */ +	writel(readl(&gpt->ctrl) | GPTCR_CLKSOURCE_32 | GPTCR_FRR, +			&gpt->ctrl); +	writel(readl(&gpt->ctrl) | GPTCR_TEN, &gpt->ctrl);  	return 0;  } @@ -101,7 +111,7 @@ ulong get_timer_masked(void)  {  	/*  	 * get_ticks() returns a long long (64 bit), it wraps in -	 * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ +	 * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~  	 * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in  	 * 5 * 10^6 days - long enough.  	 */ @@ -132,5 +142,5 @@ void __udelay(unsigned long usec)   */  ulong get_tbclk(void)  { -	return TIMER_FREQ_HZ; +	return MXC_CLK32;  } diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/cpu/arm1176/bcm2835/Makefile new file mode 100644 index 000000000..4ea6d6b89 --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/Makefile @@ -0,0 +1,37 @@ +# +# 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 +# version 2 as published by the Free Software Foundation. +# +# 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. +# + +include $(TOPDIR)/config.mk + +LIB	= $(obj)lib$(SOC).o + +SOBJS	:= lowlevel_init.o +COBJS	:= reset.o timer.o + +SRCS	:= $(SOBJS:.o=.c) $(COBJS:.o=.c) +OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS)) + +all:	$(obj).depend $(LIB) + +$(LIB):	$(OBJS) +	$(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/arm1176/bcm2835/config.mk b/arch/arm/cpu/arm1176/bcm2835/config.mk new file mode 100644 index 000000000..b87ce244c --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/config.mk @@ -0,0 +1,19 @@ +# +# (C) Copyright 2012 Stephen Warren +# +# 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 +# version 2 as published by the Free Software Foundation. +# +# 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. + +# Don't attempt to override the target CPU/ABI options; +# the Raspberry Pi toolchain does the right thing by default. +PLATFORM_RELFLAGS := $(filter-out -msoft-float,$(PLATFORM_RELFLAGS)) +PLATFORM_CPPFLAGS := $(filter-out -march=armv5t,$(PLATFORM_CPPFLAGS)) diff --git a/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S b/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S new file mode 100644 index 000000000..c7b084328 --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S @@ -0,0 +1,19 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +.globl lowlevel_init +lowlevel_init: +	mov	pc, lr diff --git a/arch/arm/cpu/arm1176/bcm2835/reset.c b/arch/arm/cpu/arm1176/bcm2835/reset.c new file mode 100644 index 000000000..8c37ad9fd --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/reset.c @@ -0,0 +1,35 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/wdog.h> + +#define RESET_TIMEOUT 10 + +void reset_cpu(ulong addr) +{ +	struct bcm2835_wdog_regs *regs = +		(struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR; +	uint32_t rstc; + +	rstc = readl(®s->rstc); +	rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK; +	rstc |= BCM2835_WDOG_RSTC_WRCFG_FULL_RESET; + +	writel(BCM2835_WDOG_PASSWORD | RESET_TIMEOUT, ®s->wdog); +	writel(BCM2835_WDOG_PASSWORD | rstc, ®s->rstc); +} diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/cpu/arm1176/bcm2835/timer.c new file mode 100644 index 000000000..d232d7e06 --- /dev/null +++ b/arch/arm/cpu/arm1176/bcm2835/timer.c @@ -0,0 +1,55 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/timer.h> + +int timer_init(void) +{ +	return 0; +} + +ulong get_timer(ulong base) +{ +	struct bcm2835_timer_regs *regs = +		(struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR; + +	return readl(®s->clo) - base; +} + +unsigned long long get_ticks(void) +{ +	return get_timer(0); +} + +ulong get_tbclk(void) +{ +	return CONFIG_SYS_HZ; +} + +void __udelay(unsigned long usec) +{ +	ulong endtime; +	signed long diff; + +	endtime = get_timer(0) + usec; + +	do { +		ulong now = get_timer(0); +		diff = endtime - now; +	} while (diff >= 0); +} diff --git a/arch/arm/cpu/arm1176/cpu.c b/arch/arm/cpu/arm1176/cpu.c index c0fd114e1..532a90b54 100644 --- a/arch/arm/cpu/arm1176/cpu.c +++ b/arch/arm/cpu/arm1176/cpu.c @@ -65,3 +65,10 @@ static void cache_flush (void)  	/* mem barrier to sync things */  	asm ("mcr p15, 0, %0, c7, c10, 4": :"r" (0));  } + +int arch_cpu_init(void) +{ +	icache_enable(); + +	return 0; +} diff --git a/arch/arm/cpu/arm720t/cpu.c b/arch/arm/cpu/arm720t/cpu.c index 974f2880a..ce7b3c9c2 100644 --- a/arch/arm/cpu/arm720t/cpu.c +++ b/arch/arm/cpu/arm720t/cpu.c @@ -51,6 +51,8 @@ int cleanup_before_linux (void)  	/* Nothing more needed */  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)  	/* No cleanup before linux for IntegratorAP/CM720T as yet */ +#elif defined(CONFIG_TEGRA) +	/* No cleanup before linux for tegra as yet */  #else  #error No cleanup_before_linux() defined for this CPU type  #endif diff --git a/arch/arm/cpu/arm720t/interrupts.c b/arch/arm/cpu/arm720t/interrupts.c index 464dd3046..c2f898f2c 100644 --- a/arch/arm/cpu/arm720t/interrupts.c +++ b/arch/arm/cpu/arm720t/interrupts.c @@ -180,6 +180,9 @@ int timer_init (void)  	PUT32(T0TC, 0);  	PUT32(T0TCR, 1);	/* enable timer0 */ +#elif defined(CONFIG_TEGRA) +	/* No timer routines for tegra as yet */ +	lastdec = 0;  #else  #error No timer_init() defined for this CPU type  #endif @@ -282,6 +285,8 @@ void __udelay (unsigned long usec)  #elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)  	/* No timer routines for IntegratorAP/CM720T as yet */ +#elif defined(CONFIG_TEGRA) +	/* No timer routines for tegra as yet */  #else  #error Timer routines not defined for this CPU type  #endif diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S index 3b97e804a..2f914e9b4 100644 --- a/arch/arm/cpu/arm720t/start.S +++ b/arch/arm/cpu/arm720t/start.S @@ -51,6 +51,16 @@ _start: b	reset  	ldr	pc, _irq  	ldr	pc, _fiq +#ifdef CONFIG_SPL_BUILD +_undefined_instruction: .word _undefined_instruction +_software_interrupt:	.word _software_interrupt +_prefetch_abort:	.word _prefetch_abort +_data_abort:		.word _data_abort +_not_used:		.word _not_used +_irq:			.word _irq +_fiq:			.word _fiq +_pad:			.word 0x12345678 /* now 16*4=64 */ +#else  _undefined_instruction: .word undefined_instruction  _software_interrupt:	.word software_interrupt  _prefetch_abort:	.word prefetch_abort @@ -58,6 +68,8 @@ _data_abort:		.word data_abort  _not_used:		.word not_used  _irq:			.word irq  _fiq:			.word fiq +_pad:			.word 0x12345678 /* now 16*4=64 */ +#endif	/* CONFIG_SPL_BUILD */  	.balignl 16,0xdeadbeef @@ -77,7 +89,11 @@ _fiq:			.word fiq  .globl _TEXT_BASE  _TEXT_BASE: +#ifdef CONFIG_SPL_BUILD +	.word	CONFIG_SPL_TEXT_BASE +#else  	.word	CONFIG_SYS_TEXT_BASE +#endif  /*   * These are defined in the board-specific linker script. @@ -167,6 +183,7 @@ stack_setup:  	adr	r0, _start  	cmp	r0, r6 +	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */  	beq	clear_bss		/* skip relocation */  	mov	r1, r6			/* r1 <- scratch for copy_loop */  	ldr	r3, _bss_start_ofs @@ -398,6 +415,8 @@ lock_loop:  	ldr	r0, VPBDIV_ADR  	mov	r1, #0x01	/* VPB clock is same as process clock */  	str	r1, [r0] +#elif defined(CONFIG_TEGRA) +	/* No cpu_init_crit for tegra as yet */  #else  #error No cpu_init_crit() defined for current CPU type  #endif @@ -413,7 +432,7 @@ lock_loop:  	str	r1, [r0]  #endif -#ifndef CONFIG_LPC2292 +#if !defined(CONFIG_LPC2292) && !defined(CONFIG_TEGRA)  	mov	ip, lr  	/*  	 * before relocating, we have to setup RAM timing @@ -427,6 +446,7 @@ lock_loop:  	mov	pc, lr +#ifndef CONFIG_SPL_BUILD  /*   *************************************************************************   * @@ -589,6 +609,7 @@ fiq:  	bl	do_fiq  #endif +#endif /* CONFIG_SPL_BUILD */  #if defined(CONFIG_NETARM)  	.align	5 @@ -620,6 +641,8 @@ reset_cpu:  .globl reset_cpu  reset_cpu:  	mov	pc, r0 +#elif defined(CONFIG_TEGRA) +	/* No specific reset actions for tegra as yet */  #else  #error No reset_cpu() defined for current CPU type  #endif diff --git a/arch/arm/cpu/arm720t/tegra20/Makefile b/arch/arm/cpu/arm720t/tegra20/Makefile new file mode 100644 index 000000000..6e484756d --- /dev/null +++ b/arch/arm/cpu/arm720t/tegra20/Makefile @@ -0,0 +1,48 @@ +# +# (C) Copyright 2010,2011 Nvidia Corporation. +# +# (C) Copyright 2000-2008 +# Wolfgang Denk, DENX Software Engineering, wd@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-y	+= cpu.o +COBJS-$(CONFIG_SPL_BUILD) += spl.o + +SRCS	:= $(COBJS-y:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS-y)) + +all:	$(obj).depend $(LIB) + +$(LIB):	$(OBJS) +	$(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/sh/include/asm/clk.h b/arch/arm/cpu/arm720t/tegra20/board.h index 9cac6b09f..61b91c005 100644 --- a/arch/sh/include/asm/clk.h +++ b/arch/arm/cpu/arm720t/tegra20/board.h @@ -1,5 +1,6 @@  /* - * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * (C) Copyright 2010-2011 + * NVIDIA Corporation <www.nvidia.com>   *   * See file CREDITS for list of people who contributed to this   * project. @@ -11,7 +12,7 @@   *   * 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 + * 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 @@ -19,17 +20,6 @@   * Foundation, Inc., 59 Temple Place, Suite 330, Boston,   * MA 02111-1307 USA   */ -#ifndef __ASM_SH_CLK_H__ -#define __ASM_SH_CLK_H__ -static inline unsigned long get_peripheral_clk_rate(void) -{ -	return CONFIG_SYS_CLK_FREQ; -} - -static inline unsigned long get_tmu0_clk_rate(void) -{ -	return CONFIG_SYS_CLK_FREQ; -} - -#endif /* __ASM_SH_CLK_H__ */ +void board_init_uart_f(void); +void gpio_config_uart(void); diff --git a/arch/arm/cpu/arm720t/tegra20/config.mk b/arch/arm/cpu/arm720t/tegra20/config.mk new file mode 100644 index 000000000..62a31d8a6 --- /dev/null +++ b/arch/arm/cpu/arm720t/tegra20/config.mk @@ -0,0 +1,26 @@ +# +# (C) Copyright 2010,2011 +# NVIDIA Corporation <www.nvidia.com> +# +# (C) Copyright 2002 +# Gary Jennejohn, DENX Software Engineering, <garyj@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 +# +USE_PRIVATE_LIBGCC = yes diff --git a/arch/arm/cpu/armv7/tegra2/ap20.c b/arch/arm/cpu/arm720t/tegra20/cpu.c index 1aad3879e..ddf8d979f 100644 --- a/arch/arm/cpu/armv7/tegra2/ap20.c +++ b/arch/arm/cpu/arm720t/tegra20/cpu.c @@ -22,54 +22,17 @@  */  #include <asm/io.h> -#include <asm/arch/tegra2.h> -#include <asm/arch/ap20.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/clk_rst.h>  #include <asm/arch/clock.h> -#include <asm/arch/fuse.h> -#include <asm/arch/gp_padctrl.h>  #include <asm/arch/pmc.h>  #include <asm/arch/pinmux.h>  #include <asm/arch/scu.h> -#include <asm/arch/warmboot.h>  #include <common.h> - -int tegra_get_chip_type(void) -{ -	struct apb_misc_gp_ctlr *gp; -	struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE; -	uint tegra_sku_id, rev; - -	/* -	 * This is undocumented, Chip ID is bits 15:8 of the register -	 * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for -	 * Tegra30 -	 */ -	gp = (struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE; -	rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT; - -	tegra_sku_id = readl(&fuse->sku_info) & 0xff; - -	switch (rev) { -	case CHIPID_TEGRA2: -		switch (tegra_sku_id) { -		case SKU_ID_T20: -			return TEGRA_SOC_T20; -		case SKU_ID_T25SE: -		case SKU_ID_AP25: -		case SKU_ID_T25: -		case SKU_ID_AP25E: -		case SKU_ID_T25E: -			return TEGRA_SOC_T25; -		} -		break; -	} -	/* unknown sku id */ -	return TEGRA_SOC_UNKNOWN; -} +#include "cpu.h"  /* Returns 1 if the current CPU executing is a Cortex-A9, else 0 */ -static int ap20_cpu_is_cortexa9(void) +int ap20_cpu_is_cortexa9(void)  {  	u32 id = readb(NV_PA_PG_UP_BASE + PG_UP_TAG_0);  	return id == (PG_UP_TAG_0_PID_CPU & 0xff); @@ -77,10 +40,8 @@ static int ap20_cpu_is_cortexa9(void)  void init_pllx(void)  { -	struct clk_rst_ctlr *clkrst = -			(struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; -	struct clk_pll_simple *pll = -		&clkrst->crc_pll_simple[CLOCK_ID_XCPU - CLOCK_ID_FIRST_SIMPLE]; +	struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; +	struct clk_pll *pll = &clkrst->crc_pll[CLOCK_ID_XCPU];  	u32 reg;  	/* If PLLX is already enabled, just return */ @@ -144,14 +105,14 @@ static void enable_cpu_clock(int enable)  static int is_cpu_powered(void)  { -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	return (readl(&pmc->pmc_pwrgate_status) & CPU_PWRED) ? 1 : 0;  }  static void remove_cpu_io_clamps(void)  { -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	u32 reg;  	/* Remove the clamps on the CPU I/O signals */ @@ -165,7 +126,7 @@ static void remove_cpu_io_clamps(void)  static void powerup_cpu(void)  { -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	u32 reg;  	int timeout = IO_STABILIZATION_DELAY; @@ -196,7 +157,7 @@ static void powerup_cpu(void)  static void enable_cpu_power_rail(void)  { -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	u32 reg;  	reg = readl(&pmc->pmc_cntrl); @@ -295,94 +256,3 @@ void halt_avp(void)  			FLOW_CTLR_HALT_COP_EVENTS);  	}  } - -void enable_scu(void) -{ -	struct scu_ctlr *scu = (struct scu_ctlr *)NV_PA_ARM_PERIPHBASE; -	u32 reg; - -	/* If SCU already setup/enabled, return */ -	if (readl(&scu->scu_ctrl) & SCU_CTRL_ENABLE) -		return; - -	/* Invalidate all ways for all processors */ -	writel(0xFFFF, &scu->scu_inv_all); - -	/* Enable SCU - bit 0 */ -	reg = readl(&scu->scu_ctrl); -	reg |= SCU_CTRL_ENABLE; -	writel(reg, &scu->scu_ctrl); -} - -static u32 get_odmdata(void) -{ -	/* -	 * ODMDATA is stored in the BCT in IRAM by the BootROM. -	 * The BCT start and size are stored in the BIT in IRAM. -	 * Read the data @ bct_start + (bct_size - 12). This works -	 * on T20 and T30 BCTs, which are locked down. If this changes -	 * in new chips (T114, etc.), we can revisit this algorithm. -	 */ - -	u32 bct_start, odmdata; - -	bct_start = readl(AP20_BASE_PA_SRAM + NVBOOTINFOTABLE_BCTPTR); -	odmdata = readl(bct_start + BCT_ODMDATA_OFFSET); - -	return odmdata; -} - -void init_pmc_scratch(void) -{ -	struct pmc_ctlr *const pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; -	u32 odmdata; -	int i; - -	/* SCRATCH0 is initialized by the boot ROM and shouldn't be cleared */ -	for (i = 0; i < 23; i++) -		writel(0, &pmc->pmc_scratch1+i); - -	/* ODMDATA is for kernel use to determine RAM size, LP config, etc. */ -	odmdata = get_odmdata(); -	writel(odmdata, &pmc->pmc_scratch20); - -#ifdef CONFIG_TEGRA2_LP0 -	/* save Sdram params to PMC 2, 4, and 24 for WB0 */ -	warmboot_save_sdram_params(); -#endif -} - -void tegra2_start(void) -{ -	struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; - -	/* If we are the AVP, start up the first Cortex-A9 */ -	if (!ap20_cpu_is_cortexa9()) { -		/* enable JTAG */ -		writel(0xC0, &pmt->pmt_cfg_ctl); - -		/* -		 * If we are ARM7 - give it a different stack. We are about to -		 * start up the A9 which will want to use this one. -		 */ -		asm volatile("mov	sp, %0\n" -			: : "r"(AVP_EARLY_BOOT_STACK_LIMIT)); - -		start_cpu((u32)_start); -		halt_avp(); -		/* not reached */ -	} - -	/* Init PMC scratch memory */ -	init_pmc_scratch(); - -	enable_scu(); - -	/* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */ -	asm volatile( -		"mrc	p15, 0, r0, c1, c0, 1\n" -		"orr	r0, r0, #0x41\n" -		"mcr	p15, 0, r0, c1, c0, 1\n"); - -	/* FIXME: should have ap20's L2 disabled too? */ -} diff --git a/arch/arm/cpu/arm720t/tegra20/cpu.h b/arch/arm/cpu/arm720t/tegra20/cpu.h new file mode 100644 index 000000000..6804cd7a3 --- /dev/null +++ b/arch/arm/cpu/arm720t/tegra20/cpu.h @@ -0,0 +1,100 @@ +/* + * (C) Copyright 2010-2011 + * NVIDIA Corporation <www.nvidia.com> + * + * 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 <asm/types.h> + +/* Stabilization delays, in usec */ +#define PLL_STABILIZATION_DELAY (300) +#define IO_STABILIZATION_DELAY	(1000) + +#define NVBL_PLLP_KHZ	(216000) + +#define PLLX_ENABLED		(1 << 30) +#define CCLK_BURST_POLICY	0x20008888 +#define SUPER_CCLK_DIVIDER	0x80000000 + +/* Calculate clock fractional divider value from ref and target frequencies */ +#define CLK_DIVIDER(REF, FREQ)  ((((REF) * 2) / FREQ) - 2) + +/* Calculate clock frequency value from reference and clock divider value */ +#define CLK_FREQUENCY(REF, REG)  (((REF) * 2) / (REG + 2)) + +/* AVP/CPU ID */ +#define PG_UP_TAG_0_PID_CPU	0x55555555	/* CPU aka "a9" aka "mpcore" */ +#define PG_UP_TAG_0             0x0 + +#define CORESIGHT_UNLOCK	0xC5ACCE55; + +/* AP20-Specific Base Addresses */ + +/* AP20 Base physical address of SDRAM. */ +#define AP20_BASE_PA_SDRAM      0x00000000 +/* AP20 Base physical address of internal SRAM. */ +#define AP20_BASE_PA_SRAM       0x40000000 +/* AP20 Size of internal SRAM (256KB). */ +#define AP20_BASE_PA_SRAM_SIZE  0x00040000 +/* AP20 Base physical address of flash. */ +#define AP20_BASE_PA_NOR_FLASH  0xD0000000 +/* AP20 Base physical address of boot information table. */ +#define AP20_BASE_PA_BOOT_INFO  AP20_BASE_PA_SRAM + +/* + * Super-temporary stacks for EXTREMELY early startup. The values chosen for + * these addresses must be valid on ALL SOCs because this value is used before + * we are able to differentiate between the SOC types. + * + * NOTE: The since CPU's stack will eventually be moved from IRAM to SDRAM, its + *       stack is placed below the AVP stack. Once the CPU stack has been moved, + *       the AVP is free to use the IRAM the CPU stack previously occupied if + *       it should need to do so. + * + * NOTE: In multi-processor CPU complex configurations, each processor will have + *       its own stack of size CPU_EARLY_BOOT_STACK_SIZE. CPU 0 will have a + *       limit of CPU_EARLY_BOOT_STACK_LIMIT. Each successive CPU will have a + *       stack limit that is CPU_EARLY_BOOT_STACK_SIZE less then the previous + *       CPU. + */ + +/* Common AVP early boot stack limit */ +#define AVP_EARLY_BOOT_STACK_LIMIT	\ +	(AP20_BASE_PA_SRAM + (AP20_BASE_PA_SRAM_SIZE/2)) +/* Common AVP early boot stack size */ +#define AVP_EARLY_BOOT_STACK_SIZE	0x1000 +/* Common CPU early boot stack limit */ +#define CPU_EARLY_BOOT_STACK_LIMIT	\ +	(AVP_EARLY_BOOT_STACK_LIMIT - AVP_EARLY_BOOT_STACK_SIZE) +/* Common CPU early boot stack size */ +#define CPU_EARLY_BOOT_STACK_SIZE	0x1000 + +#define EXCEP_VECTOR_CPU_RESET_VECTOR	(NV_PA_EVP_BASE + 0x100) +#define CSITE_CPU_DBG0_LAR		(NV_PA_CSITE_BASE + 0x10FB0) +#define CSITE_CPU_DBG1_LAR		(NV_PA_CSITE_BASE + 0x12FB0) + +#define FLOW_CTLR_HALT_COP_EVENTS	(NV_PA_FLOW_BASE + 4) +#define FLOW_MODE_STOP			2 +#define HALT_COP_EVENT_JTAG		(1 << 28) +#define HALT_COP_EVENT_IRQ_1		(1 << 11) +#define HALT_COP_EVENT_FIQ_1		(1 << 9) + +void start_cpu(u32 reset_vector); +int ap20_cpu_is_cortexa9(void); +void halt_avp(void)  __attribute__ ((noreturn)); diff --git a/arch/arm/cpu/arm720t/tegra20/spl.c b/arch/arm/cpu/arm720t/tegra20/spl.c new file mode 100644 index 000000000..6c16dce29 --- /dev/null +++ b/arch/arm/cpu/arm720t/tegra20/spl.c @@ -0,0 +1,133 @@ +/* + * (C) Copyright 2012 + * NVIDIA Inc, <www.nvidia.com> + * + * Allen Martin <amartin@nvidia.com> + * + * 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 <common.h> +#include <asm/u-boot.h> +#include <asm/utils.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/clock.h> +#include <nand.h> +#include <mmc.h> +#include <fat.h> +#include <version.h> +#include <i2c.h> +#include <image.h> +#include <malloc.h> +#include <linux/compiler.h> +#include "board.h" +#include "cpu.h" + +#include <asm/io.h> +#include <asm/arch/tegra20.h> +#include <asm/arch/clk_rst.h> +#include <asm/arch/clock.h> +#include <asm/arch/pmc.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/scu.h> +#include <common.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* Define global data structure pointer to it*/ +static gd_t gdata __attribute__ ((section(".data"))); +static bd_t bdata __attribute__ ((section(".data"))); + +inline void hang(void) +{ +	puts("### ERROR ### Please RESET the board ###\n"); +	for (;;) +		; +} + +void board_init_f(ulong dummy) +{ +	board_init_uart_f(); + +	/* Initialize periph GPIOs */ +#ifdef CONFIG_SPI_UART_SWITCH +	gpio_early_init_uart(); +#else +	gpio_config_uart(); +#endif + +	/* +	 * We call relocate_code() with relocation target same as the +	 * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting +	 * skipped. Instead, only .bss initialization will happen. That's +	 * all we need +	 */ +	debug(">>board_init_f()\n"); +	relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE); +} + +/* This requires UART clocks to be enabled */ +static void preloader_console_init(void) +{ +	const char *u_boot_rev = U_BOOT_VERSION; + +	gd = &gdata; +	gd->bd = &bdata; +	gd->flags |= GD_FLG_RELOC; +	gd->baudrate = CONFIG_BAUDRATE; + +	serial_init();		/* serial communications setup */ + +	gd->have_console = 1; + +	/* Avoid a second "U-Boot" coming from this string */ +	u_boot_rev = &u_boot_rev[7]; + +	printf("\nU-Boot SPL %s (%s - %s)\n", u_boot_rev, U_BOOT_DATE, +		U_BOOT_TIME); +} + +void board_init_r(gd_t *id, ulong dummy) +{ +	struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + +	/* enable JTAG */ +	writel(0xC0, &pmt->pmt_cfg_ctl); + +	debug(">>spl:board_init_r()\n"); + +	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, +			CONFIG_SYS_SPL_MALLOC_SIZE); + +#ifdef CONFIG_SPL_BOARD_INIT +	spl_board_init(); +#endif + +	clock_early_init(); +	serial_init(); +	preloader_console_init(); + +	start_cpu((u32)CONFIG_SYS_TEXT_BASE); +	halt_avp(); +	/* not reached */ +} + +int board_usb_init(const void *blob) +{ +	return 0; +} diff --git a/arch/arm/cpu/arm926ejs/at91/Makefile b/arch/arm/cpu/arm926ejs/at91/Makefile index f333753c7..346e58fae 100644 --- a/arch/arm/cpu/arm926ejs/at91/Makefile +++ b/arch/arm/cpu/arm926ejs/at91/Makefile @@ -35,6 +35,7 @@ COBJS-$(CONFIG_AT91SAM9263)	+= at91sam9263_devices.o  COBJS-$(CONFIG_AT91SAM9RL)	+= at91sam9rl_devices.o  COBJS-$(CONFIG_AT91SAM9M10G45)	+= at91sam9m10g45_devices.o  COBJS-$(CONFIG_AT91SAM9G45)	+= at91sam9m10g45_devices.o +COBJS-$(CONFIG_AT91SAM9X5)	+= at91sam9x5_devices.o  COBJS-$(CONFIG_AT91_EFLASH)	+= eflash.o  COBJS-$(CONFIG_AT91_LED)	+= led.o  COBJS-y += clock.o diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c index 62f76fa8e..19ec615c7 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c @@ -158,6 +158,10 @@ void at91_spi1_hw_init(unsigned long cs_mask)  #ifdef CONFIG_MACB  void at91_macb_hw_init(void)  { +	/* Enable EMAC clock */ +	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; +	writel(1 << ATMEL_ID_EMAC0, &pmc->pcer); +  	at91_set_a_periph(AT91_PIO_PORTA, 19, 0);	/* ETXCK_EREFCK */  	at91_set_a_periph(AT91_PIO_PORTA, 17, 0);	/* ERXDV */  	at91_set_a_periph(AT91_PIO_PORTA, 14, 0);	/* ERX0 */ diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c new file mode 100644 index 000000000..6d77219d0 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2012 Atmel Corporation + * + * 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 <common.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/gpio.h> +#include <asm/io.h> + +unsigned int get_chip_id(void) +{ +	/* The 0x40 is the offset of cidr in DBGU */ +	return readl(ATMEL_BASE_DBGU + 0x40) & ~ARCH_ID_VERSION_MASK; +} + +unsigned int get_extension_chip_id(void) +{ +	/* The 0x44 is the offset of exid in DBGU */ +	return readl(ATMEL_BASE_DBGU + 0x44); +} + +unsigned int has_emac1() +{ +	return cpu_is_at91sam9x25(); +} + +unsigned int has_emac0() +{ +	return !(cpu_is_at91sam9g15()); +} + +unsigned int has_lcdc() +{ +	return cpu_is_at91sam9g15() || cpu_is_at91sam9g35() +		|| cpu_is_at91sam9x35(); +} + +char *get_cpu_name() +{ +	unsigned int extension_id = get_extension_chip_id(); + +	if (cpu_is_at91sam9x5()) { +		switch (extension_id) { +		case ARCH_EXID_AT91SAM9G15: +			return CONFIG_SYS_AT91_G15_CPU_NAME; +		case ARCH_EXID_AT91SAM9G25: +			return CONFIG_SYS_AT91_G25_CPU_NAME; +		case ARCH_EXID_AT91SAM9G35: +			return CONFIG_SYS_AT91_G35_CPU_NAME; +		case ARCH_EXID_AT91SAM9X25: +			return CONFIG_SYS_AT91_X25_CPU_NAME; +		case ARCH_EXID_AT91SAM9X35: +			return CONFIG_SYS_AT91_X35_CPU_NAME; +		default: +			return CONFIG_SYS_AT91_UNKNOWN_CPU; +		} +	} else { +		return CONFIG_SYS_AT91_UNKNOWN_CPU; +	} +} + +void at91_seriald_hw_init(void) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_a_periph(AT91_PIO_PORTA, 9, 0);	/* DRXD */ +	at91_set_a_periph(AT91_PIO_PORTA, 10, 1);	/* DTXD */ + +	writel(1 << ATMEL_ID_SYS, &pmc->pcer); +} + +void at91_serial0_hw_init(void) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_a_periph(AT91_PIO_PORTA, 0, 1);	/* TXD */ +	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);	/* RXD */ + +	writel(1 << ATMEL_ID_USART0, &pmc->pcer); +} + +void at91_serial1_hw_init(void) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_a_periph(AT91_PIO_PORTA, 5, 1);	/* TXD */ +	at91_set_a_periph(AT91_PIO_PORTA, 6, 0);	/* RXD */ + +	writel(1 << ATMEL_ID_USART1, &pmc->pcer); +} + +void at91_serial2_hw_init(void) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_a_periph(AT91_PIO_PORTA, 7, 1);	/* TXD */ +	at91_set_a_periph(AT91_PIO_PORTA, 8, 0);	/* RXD */ + +	writel(1 << ATMEL_ID_USART2, &pmc->pcer); +} + +#ifdef CONFIG_ATMEL_SPI +void at91_spi0_hw_init(unsigned long cs_mask) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */ +	at91_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */ +	at91_set_a_periph(AT91_PIO_PORTA, 13, 0);	/* SPI0_SPCK */ + +	/* Enable clock */ +	writel(1 << ATMEL_ID_SPI0, &pmc->pcer); + +	if (cs_mask & (1 << 0)) +		at91_set_a_periph(AT91_PIO_PORTA, 14, 0); +	if (cs_mask & (1 << 1)) +		at91_set_b_periph(AT91_PIO_PORTA, 7, 0); +	if (cs_mask & (1 << 2)) +		at91_set_b_periph(AT91_PIO_PORTA, 1, 0); +	if (cs_mask & (1 << 3)) +		at91_set_b_periph(AT91_PIO_PORTB, 3, 0); +	if (cs_mask & (1 << 4)) +		at91_set_pio_output(AT91_PIO_PORTA, 14, 0); +	if (cs_mask & (1 << 5)) +		at91_set_pio_output(AT91_PIO_PORTA, 7, 0); +	if (cs_mask & (1 << 6)) +		at91_set_pio_output(AT91_PIO_PORTA, 1, 0); +	if (cs_mask & (1 << 7)) +		at91_set_pio_output(AT91_PIO_PORTB, 3, 0); +} + +void at91_spi1_hw_init(unsigned long cs_mask) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	at91_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */ +	at91_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */ +	at91_set_b_periph(AT91_PIO_PORTA, 23, 0);	/* SPI1_SPCK */ + +	/* Enable clock */ +	writel(1 << ATMEL_ID_SPI1, &pmc->pcer); + +	if (cs_mask & (1 << 0)) +		at91_set_b_periph(AT91_PIO_PORTA, 8, 0); +	if (cs_mask & (1 << 1)) +		at91_set_b_periph(AT91_PIO_PORTA, 0, 0); +	if (cs_mask & (1 << 2)) +		at91_set_b_periph(AT91_PIO_PORTA, 31, 0); +	if (cs_mask & (1 << 3)) +		at91_set_b_periph(AT91_PIO_PORTA, 30, 0); +	if (cs_mask & (1 << 4)) +		at91_set_pio_output(AT91_PIO_PORTA, 8, 0); +	if (cs_mask & (1 << 5)) +		at91_set_pio_output(AT91_PIO_PORTA, 0, 0); +	if (cs_mask & (1 << 6)) +		at91_set_pio_output(AT91_PIO_PORTA, 31, 0); +	if (cs_mask & (1 << 7)) +		at91_set_pio_output(AT91_PIO_PORTA, 30, 0); +} +#endif + +#ifdef CONFIG_MACB +void at91_macb_hw_init(void) +{ +	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; + +	if (has_emac0()) { +		/* Enable EMAC0 clock */ +		writel(1 << ATMEL_ID_EMAC0, &pmc->pcer); +		/* EMAC0 pins setup */ +		at91_set_a_periph(AT91_PIO_PORTB, 4, 0);	/* ETXCK */ +		at91_set_a_periph(AT91_PIO_PORTB, 3, 0);	/* ERXDV */ +		at91_set_a_periph(AT91_PIO_PORTB, 0, 0);	/* ERX0 */ +		at91_set_a_periph(AT91_PIO_PORTB, 1, 0);	/* ERX1 */ +		at91_set_a_periph(AT91_PIO_PORTB, 2, 0);	/* ERXER */ +		at91_set_a_periph(AT91_PIO_PORTB, 7, 0);	/* ETXEN */ +		at91_set_a_periph(AT91_PIO_PORTB, 9, 0);	/* ETX0 */ +		at91_set_a_periph(AT91_PIO_PORTB, 10, 0);	/* ETX1 */ +		at91_set_a_periph(AT91_PIO_PORTB, 5, 0);	/* EMDIO */ +		at91_set_a_periph(AT91_PIO_PORTB, 6, 0);	/* EMDC */ +	} + +	if (has_emac1()) { +		/* Enable EMAC1 clock */ +		writel(1 << ATMEL_ID_EMAC1, &pmc->pcer); +		/* EMAC1 pins setup */ +		at91_set_b_periph(AT91_PIO_PORTC, 29, 0);	/* ETXCK */ +		at91_set_b_periph(AT91_PIO_PORTC, 28, 0);	/* ECRSDV */ +		at91_set_b_periph(AT91_PIO_PORTC, 20, 0);	/* ERXO */ +		at91_set_b_periph(AT91_PIO_PORTC, 21, 0);	/* ERX1 */ +		at91_set_b_periph(AT91_PIO_PORTC, 16, 0);	/* ERXER */ +		at91_set_b_periph(AT91_PIO_PORTC, 27, 0);	/* ETXEN */ +		at91_set_b_periph(AT91_PIO_PORTC, 18, 0);	/* ETX0 */ +		at91_set_b_periph(AT91_PIO_PORTC, 19, 0);	/* ETX1 */ +		at91_set_b_periph(AT91_PIO_PORTC, 31, 0);	/* EMDIO */ +		at91_set_b_periph(AT91_PIO_PORTC, 30, 0);	/* EMDC */ +	} + +#ifndef CONFIG_RMII +	/* Only emac0 support MII */ +	if (has_emac0()) { +		at91_set_b_periph(AT91_PIO_PORTB, 16, 0);	/* ECRS */ +		at91_set_b_periph(AT91_PIO_PORTB, 17, 0);	/* ECOL */ +		at91_set_b_periph(AT91_PIO_PORTB, 13, 0);	/* ERX2 */ +		at91_set_b_periph(AT91_PIO_PORTB, 14, 0);	/* ERX3 */ +		at91_set_b_periph(AT91_PIO_PORTB, 15, 0);	/* ERXCK */ +		at91_set_b_periph(AT91_PIO_PORTB, 11, 0);	/* ETX2 */ +		at91_set_b_periph(AT91_PIO_PORTB, 12, 0);	/* ETX3 */ +		at91_set_b_periph(AT91_PIO_PORTB, 8, 0);	/* ETXER */ +	} +#endif +} +#endif diff --git a/arch/arm/cpu/arm926ejs/at91/clock.c b/arch/arm/cpu/arm926ejs/at91/clock.c index a7085deac..dc5c6c4b0 100644 --- a/arch/arm/cpu/arm926ejs/at91/clock.c +++ b/arch/arm/cpu/arm926ejs/at91/clock.c @@ -154,7 +154,8 @@ int at91_clock_init(unsigned long main_clock)  	 * For now, assume this parentage won't change.  	 */  	mckr = readl(&pmc->mckr); -#if defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#if defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) \ +		|| defined(CONFIG_AT91SAM9X5)  	/* plla divisor by 2 */  	gd->plla_rate_hz /= (1 << ((mckr & 1 << 12) >> 12));  #endif @@ -168,7 +169,14 @@ int at91_clock_init(unsigned long main_clock)  		freq / ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 7) : freq;  	if (mckr & AT91_PMC_MCKR_MDIV_MASK)  		freq /= 2;			/* processor clock division */ -#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) \ +		|| defined(CONFIG_AT91SAM9X5) +	/* mdiv <==> divisor +	 *  0   <==>   1 +	 *  1   <==>   2 +	 *  2   <==>   4 +	 *  3   <==>   3 +	 */  	gd->mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ==  		(AT91_PMC_MCKR_MDIV_2 | AT91_PMC_MCKR_MDIV_4)  		? freq / 3 diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c index c47fb31e9..5cf4fad0b 100644 --- a/arch/arm/cpu/arm926ejs/at91/cpu.c +++ b/arch/arm/cpu/arm926ejs/at91/cpu.c @@ -71,29 +71,3 @@ int print_cpuinfo(void)  	return 0;  }  #endif - -#ifdef CONFIG_BOOTCOUNT_LIMIT -/* - * We combine the BOOTCOUNT_MAGIC and bootcount in one 32-bit register. - * This is done so we need to use only one of the four GPBR registers. - */ -void bootcount_store (ulong a) -{ -	at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR; - -	writel((BOOTCOUNT_MAGIC & 0xffff0000) | (a & 0x0000ffff), -		&gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]); -} - -ulong bootcount_load (void) -{ -	at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR; - -	ulong val = readl(&gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]); -	if ((val & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000)) -		return 0; -	else -		return val & 0x0000ffff; -} - -#endif /* CONFIG_BOOTCOUNT_LIMIT */ diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index da7efac08..c91928e71 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o -COBJS-y				+= cpu.o misc.o timer.o psc.o pinmux.o +COBJS-y				+= cpu.o misc.o timer.o psc.o pinmux.o reset.o  COBJS-$(CONFIG_DA850_LOWLEVEL)	+= da850_lowlevel.o  COBJS-$(CONFIG_SOC_DM355)	+= dm355.o  COBJS-$(CONFIG_SOC_DM365)	+= dm365.o @@ -42,8 +42,6 @@ COBJS-$(CONFIG_SOC_DM365)	+= dm365_lowlevel.o  COBJS-$(CONFIG_SOC_DA8XX)	+= da850_lowlevel.o  endif -SOBJS	= reset.o -  ifndef CONFIG_SKIP_LOWLEVEL_INIT  SOBJS	+= lowlevel_init.o  endif diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c b/arch/arm/cpu/arm926ejs/davinci/cpu.c index 6cb857aef..b31add8de 100644 --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c @@ -117,6 +117,17 @@ int clk_get(enum davinci_clk_ids id)  out:  	return pll_out;  } + +int set_cpu_clk_info(void) +{ +	gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000; +	/* DDR PHY uses an x2 input clock */ +	gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 : +				(clk_get(DAVINCI_DDR_CLKID) / 1000000); +	gd->bd->bi_dsp_freq = 0; +	return 0; +} +  #else /* CONFIG_SOC_DA8XX */  static unsigned pll_div(volatile void *pllbase, unsigned offset) @@ -187,16 +198,9 @@ unsigned int davinci_clk_get(unsigned int div)  	return pll_sysclk_mhz(DAVINCI_PLL_CNTRL0_BASE, div) * 1000000;  }  #endif -#endif /* !CONFIG_SOC_DA8XX */  int set_cpu_clk_info(void)  { -#ifdef CONFIG_SOC_DA8XX -	gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 1000000; -	/* DDR PHY uses an x2 input clock */ -	gd->bd->bi_ddr_freq = clk_get(0x10001) / 1000000; -#else -  	unsigned int pllbase = DAVINCI_PLL_CNTRL0_BASE;  #if defined(CONFIG_SOC_DM365)  	pllbase = DAVINCI_PLL_CNTRL1_BASE; @@ -215,10 +219,12 @@ int set_cpu_clk_info(void)  	pllbase = DAVINCI_PLL_CNTRL0_BASE;  #endif  	gd->bd->bi_ddr_freq = pll_sysclk_mhz(pllbase, DDR_PLLDIV) / 2; -#endif +  	return 0;  } +#endif /* !CONFIG_SOC_DA8XX */ +  /*   * Initializes on-chip ethernet controllers.   * to override, implement board_eth_init() diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index df7d6a24b..ff2e2e33d 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -190,13 +190,21 @@ int da850_ddr_setup(void)  		setbits_le32(&davinci_syscfg1_regs->vtpio_ctl, VTP_LOCK);  		setbits_le32(&davinci_syscfg1_regs->vtpio_ctl, VTP_POWERDWN); - -		setbits_le32(&davinci_syscfg1_regs->vtpio_ctl, VTP_IOPWRDWN);  	} - +	setbits_le32(&davinci_syscfg1_regs->vtpio_ctl, VTP_IOPWRDWN);  	writel(CONFIG_SYS_DA850_DDR2_DDRPHYCR, &dv_ddr2_regs_ctrl->ddrphycr); -	clrbits_le32(&davinci_syscfg1_regs->ddr_slew, -		(1 << DDR_SLEW_CMOSEN_BIT)); + +	if (CONFIG_SYS_DA850_DDR2_SDBCR & (1 << DV_DDR_SDCR_DDR2EN_SHIFT)) { +		/* DDR2 */ +		clrbits_le32(&davinci_syscfg1_regs->ddr_slew, +			(1 << DDR_SLEW_DDR_PDENA_BIT) | +			(1 << DDR_SLEW_CMOSEN_BIT)); +	} else { +		/* MOBILE DDR */ +		setbits_le32(&davinci_syscfg1_regs->ddr_slew, +			(1 << DDR_SLEW_DDR_PDENA_BIT) | +			(1 << DDR_SLEW_CMOSEN_BIT)); +	}  	/*  	 * SDRAM Configuration Register (SDCR): @@ -216,7 +224,11 @@ int da850_ddr_setup(void)  	writel(tmp, &dv_ddr2_regs_ctrl->sdbcr);  	/* write memory configuration and timing */ -	writel(CONFIG_SYS_DA850_DDR2_SDBCR2, &dv_ddr2_regs_ctrl->sdbcr2); +	if (!(CONFIG_SYS_DA850_DDR2_SDBCR & (1 << DV_DDR_SDCR_DDR2EN_SHIFT))) { +		/* MOBILE DDR only*/ +		writel(CONFIG_SYS_DA850_DDR2_SDBCR2, +			&dv_ddr2_regs_ctrl->sdbcr2); +	}  	writel(CONFIG_SYS_DA850_DDR2_SDTIMR, &dv_ddr2_regs_ctrl->sdtimr);  	writel(CONFIG_SYS_DA850_DDR2_SDTIMR2, &dv_ddr2_regs_ctrl->sdtimr2); @@ -240,7 +252,7 @@ int da850_ddr_setup(void)  	/* disable self refresh */  	clrbits_le32(&dv_ddr2_regs_ctrl->sdrcr, -		DV_DDR_SDRCR_LPMODEN | DV_DDR_SDRCR_LPMODEN); +		DV_DDR_SDRCR_LPMODEN | DV_DDR_SDRCR_MCLKSTOPEN);  	writel(CONFIG_SYS_DA850_DDR2_PBBPR, &dv_ddr2_regs_ctrl->pbbpr);  	return 0; diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c index fa07fb591..133265e5b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c @@ -35,6 +35,11 @@ const struct pinmux_config spi1_pins_scs0[] = {  };  /* UART pin muxer settings */ +const struct pinmux_config uart0_pins_txrx[] = { +	{ pinmux(3), 2, 4 }, /* UART0_RXD */ +	{ pinmux(3), 2, 5 }, /* UART0_TXD */ +}; +  const struct pinmux_config uart1_pins_txrx[] = {  	{ pinmux(4), 2, 6 }, /* UART1_RXD */  	{ pinmux(4), 2, 7 }, /* UART1_TXD */ @@ -169,3 +174,14 @@ const struct pinmux_config emifa_pins_nor[] = {  	{ pinmux(12), 1, 6 }, /* EMA_A[1] */  	{ pinmux(12), 1, 7 }, /* EMA_A[0] */  }; + +/* MMC0 pin muxer settings */ +const struct pinmux_config mmc0_pins[] = { +	{ pinmux(10), 2, 0 },	/* MMCSD0_CLK */ +	{ pinmux(10), 2, 1 },	/* MMCSD0_CMD */ +	{ pinmux(10), 2, 2 },	/* MMCSD0_DAT_0 */ +	{ pinmux(10), 2, 3 },	/* MMCSD0_DAT_1 */ +	{ pinmux(10), 2, 4 },	/* MMCSD0_DAT_2 */ +	{ pinmux(10), 2, 5 },	/* MMCSD0_DAT_3 */ +	/* DA850 supports only 4-bit mode, remaining pins are not configured */ +}; diff --git a/arch/arm/cpu/arm926ejs/davinci/psc.c b/arch/arm/cpu/arm926ejs/davinci/psc.c index 3e925181e..2ffb42abc 100644 --- a/arch/arm/cpu/arm926ejs/davinci/psc.c +++ b/arch/arm/cpu/arm926ejs/davinci/psc.c @@ -128,6 +128,11 @@ void lpsc_syncreset(unsigned int id)  	lpsc_transition(id, 0x01);  } +void lpsc_disable(unsigned int id) +{ +	lpsc_transition(id, 0x0); +} +  /* Not all DaVinci chips have a DSP power domain. */  #ifdef CONFIG_SOC_DM644X diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.S b/arch/arm/cpu/arm926ejs/davinci/reset.S deleted file mode 100644 index ba0a7c3b4..000000000 --- a/arch/arm/cpu/arm926ejs/davinci/reset.S +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Processor reset using WDT for TI TMS320DM644x SoC. - * - * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> - * - * ----------------------------------------------------- - * - * 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 - */ - -.globl reset_cpu -reset_cpu: -	ldr	r0, WDT_TGCR -	mov	r1, $0x08 -	str	r1, [r0] -	ldr	r1, [r0] -	orr	r1, r1, $0x03 -	str	r1, [r0] -	mov	r1, $0 -	ldr	r0, WDT_TIM12 -	str	r1, [r0] -	ldr	r0, WDT_TIM34 -	str	r1, [r0] -	ldr	r0, WDT_PRD12 -	str	r1, [r0] -	ldr	r0, WDT_PRD34 -	str	r1, [r0] -	ldr	r0, WDT_TCR -	ldr	r1, [r0] -	orr	r1, r1, $0x40 -	str	r1, [r0] -	ldr	r0, WDT_WDTCR -	ldr	r1, [r0] -	orr	r1, r1, $0x4000 -	str	r1, [r0] -	ldr	r1, WDTCR_VAL1 -	str	r1, [r0] -	ldr	r1, WDTCR_VAL2 -	str	r1, [r0] -	/* Write an invalid value to the WDKEY field to trigger -	 * an immediate watchdog reset */ -	mov     r1, $0x4000 -	str     r1, [r0] -	nop -	nop -	nop -	nop -reset_cpu_loop: -	b	reset_cpu_loop - -WDT_TGCR: -	.word	0x01c21c24 -WDT_TIM12: -	.word	0x01c21c10 -WDT_TIM34: -	.word	0x01c21c14 -WDT_PRD12: -	.word	0x01c21c18 -WDT_PRD34: -	.word	0x01c21c1c -WDT_TCR: -	.word	0x01c21c20 -WDT_WDTCR: -	.word	0x01c21c28 -WDTCR_VAL1: -	.word	0xa5c64000 -WDTCR_VAL2: -	.word	0xda7e4000 diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.c b/arch/arm/cpu/arm926ejs/davinci/reset.c new file mode 100644 index 000000000..968fb035c --- /dev/null +++ b/arch/arm/cpu/arm926ejs/davinci/reset.c @@ -0,0 +1,33 @@ +/* + *  Processor reset using WDT. + * + * Copyright (C) 2012 Dmitry Bondar <bond@inmys.ru> + * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> + * + * This file is released under the terms of GPL v2 and any later version. + * See the file COPYING in the root directory of the source tree for details. +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/timer_defs.h> +#include <asm/arch/hardware.h> + +void reset_cpu(unsigned long a) +{ +	struct davinci_timer *const wdttimer = +		(struct davinci_timer *)DAVINCI_TIMER1_BASE; +	writel(0x08, &wdttimer->tgcr); +	writel(readl(&wdttimer->tgcr) | 0x03, &wdttimer->tgcr); +	writel(0, &wdttimer->tim12); +	writel(0, &wdttimer->tim34); +	writel(0, &wdttimer->prd12); +	writel(0, &wdttimer->prd34); +	writel(readl(&wdttimer->tcr) | 0x40, &wdttimer->tcr); +	writel(readl(&wdttimer->wdtcr) | 0x4000, &wdttimer->wdtcr); +	writel(0xa5c64000, &wdttimer->wdtcr); +	writel(0xda7e4000, &wdttimer->wdtcr); +	writel(0x4000, &wdttimer->wdtcr); +	while (1) +		/*nothing*/; +} diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index 74632e516..03c85c87f 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -28,6 +28,7 @@  #include <ns16550.h>  #include <malloc.h>  #include <spi_flash.h> +#include <mmc.h>  #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT @@ -74,12 +75,7 @@ void board_init_f(ulong dummy)  void board_init_r(gd_t *id, ulong dummy)  { -#ifdef CONFIG_SPL_NAND_LOAD -	nand_init(); -	puts("Nand boot...\n"); -	nand_boot(); -#endif -#ifdef CONFIG_SPL_SPI_LOAD +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT  	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,  			CONFIG_SYS_MALLOC_LEN); @@ -90,7 +86,19 @@ void board_init_r(gd_t *id, ulong dummy)  	serial_init();          /* serial communications setup */  	gd->have_console = 1; +#endif + +#ifdef CONFIG_SPL_NAND_LOAD +	nand_init(); +	puts("Nand boot...\n"); +	nand_boot(); +#endif +#ifdef CONFIG_SPL_SPI_LOAD  	puts("SPI boot...\n");  	spi_boot();  #endif +#ifdef CONFIG_SPL_MMC_LOAD +	puts("MMC boot...\n"); +	spl_mmc_load(); +#endif  } diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c index 8b07dae2b..90e584ac5 100644 --- a/arch/arm/cpu/arm926ejs/mx25/generic.c +++ b/arch/arm/cpu/arm926ejs/mx25/generic.c @@ -64,7 +64,7 @@ static unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref)  static ulong imx_get_mpllclk(void)  {  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE; -	ulong fref = 24000000; +	ulong fref = MXC_HCLK;  	return imx_decode_pll(readl(&ccm->mpctl), fref);  } @@ -186,6 +186,14 @@ int print_cpuinfo(void)  }  #endif +void enable_caches(void) +{ +#ifndef CONFIG_SYS_DCACHE_OFF +	/* Enable D-cache. I-cache is already enabled in start.S */ +	dcache_enable(); +#endif +} +  int cpu_eth_init(bd_t *bis)  {  #if defined(CONFIG_FEC_MXC) diff --git a/arch/arm/cpu/arm926ejs/mx25/timer.c b/arch/arm/cpu/arm926ejs/mx25/timer.c index 1cfd02b23..4dc4041c0 100644 --- a/arch/arm/cpu/arm926ejs/mx25/timer.c +++ b/arch/arm/cpu/arm926ejs/mx25/timer.c @@ -40,6 +40,7 @@  #include <div64.h>  #include <asm/io.h>  #include <asm/arch/imx-regs.h> +#include <asm/arch/clock.h>  DECLARE_GLOBAL_DATA_PTR; @@ -55,28 +56,27 @@ DECLARE_GLOBAL_DATA_PTR;  static inline unsigned long long tick_to_time(unsigned long long tick)  {  	tick *= CONFIG_SYS_HZ; -	do_div(tick, CONFIG_MX25_CLK32); +	do_div(tick, MXC_CLK32);  	return tick;  }  static inline unsigned long long time_to_tick(unsigned long long time)  { -	time *= CONFIG_MX25_CLK32; +	time *= MXC_CLK32;  	do_div(time, CONFIG_SYS_HZ);  	return time;  }  static inline unsigned long long us_to_tick(unsigned long long us)  { -	us = us * CONFIG_MX25_CLK32 + 999999; +	us = us * MXC_CLK32 + 999999;  	do_div(us, 1000000);  	return us;  }  #else  /* ~2% error */ -#define TICK_PER_TIME	((CONFIG_MX25_CLK32 + CONFIG_SYS_HZ / 2) / \ -		CONFIG_SYS_HZ) -#define US_PER_TICK	(1000000 / CONFIG_MX25_CLK32) +#define TICK_PER_TIME	((MXC_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) +#define US_PER_TICK	(1000000 / MXC_CLK32)  static inline unsigned long long tick_to_time(unsigned long long tick)  { @@ -144,7 +144,7 @@ ulong get_timer_masked(void)  {  	/*  	 * get_ticks() returns a long long (64 bit), it wraps in -	 * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ +	 * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~  	 * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in  	 * 5 * 10^6 days - long enough.  	 */ @@ -177,6 +177,6 @@ ulong get_tbclk(void)  {  	ulong tbclk; -	tbclk = CONFIG_MX25_CLK32; +	tbclk = MXC_CLK32;  	return tbclk;  } diff --git a/arch/arm/cpu/arm926ejs/mx27/generic.c b/arch/arm/cpu/arm926ejs/mx27/generic.c index 65c481378..41bb84bb6 100644 --- a/arch/arm/cpu/arm926ejs/mx27/generic.c +++ b/arch/arm/cpu/arm926ejs/mx27/generic.c @@ -24,6 +24,7 @@  #include <asm/io.h>  #include <asm/arch/imx-regs.h>  #include <asm/arch/clock.h> +#include <asm/arch/gpio.h>  #ifdef CONFIG_MXC_MMC  #include <asm/arch/mxcmmc.h>  #endif @@ -209,7 +210,7 @@ int cpu_mmc_init(bd_t *bis)  void imx_gpio_mode(int gpio_mode)  { -	struct gpio_regs *regs = (struct gpio_regs *)IMX_GPIO_BASE; +	struct gpio_port_regs *regs = (struct gpio_port_regs *)IMX_GPIO_BASE;  	unsigned int pin = gpio_mode & GPIO_PIN_MASK;  	unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;  	unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT; @@ -228,11 +229,11 @@ void imx_gpio_mode(int gpio_mode)  	/* Data direction */  	if (gpio_mode & GPIO_OUT) { -		writel(readl(®s->port[port].ddir) | 1 << pin, -				®s->port[port].ddir); +		writel(readl(®s->port[port].gpio_dir) | 1 << pin, +				®s->port[port].gpio_dir);  	} else { -		writel(readl(®s->port[port].ddir) & ~(1 << pin), -				®s->port[port].ddir); +		writel(readl(®s->port[port].gpio_dir) & ~(1 << pin), +				®s->port[port].gpio_dir);  	}  	/* Primary / alternate function */ diff --git a/arch/arm/cpu/arm926ejs/mx28/Makefile b/arch/arm/cpu/arm926ejs/mxs/Makefile index 674a3af1b..eeecf89f8 100644 --- a/arch/arm/cpu/arm926ejs/mx28/Makefile +++ b/arch/arm/cpu/arm926ejs/mxs/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o -COBJS	= clock.o mx28.o iomux.o timer.o +COBJS	= clock.o mxs.o iomux.o timer.o  ifdef	CONFIG_SPL_BUILD  COBJS	+= spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o diff --git a/arch/arm/cpu/arm926ejs/mx28/clock.c b/arch/arm/cpu/arm926ejs/mxs/clock.c index 0439f9c0e..bfea6abeb 100644 --- a/arch/arm/cpu/arm926ejs/mx28/clock.c +++ b/arch/arm/cpu/arm926ejs/mxs/clock.c @@ -43,8 +43,8 @@  static uint32_t mx28_get_pclk(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t clkctrl, clkseq, div;  	uint8_t clkfrac, frac; @@ -75,8 +75,8 @@ static uint32_t mx28_get_pclk(void)  static uint32_t mx28_get_hclk(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t div;  	uint32_t clkctrl; @@ -93,8 +93,8 @@ static uint32_t mx28_get_hclk(void)  static uint32_t mx28_get_emiclk(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t clkctrl, clkseq, div;  	uint8_t clkfrac, frac; @@ -118,8 +118,8 @@ static uint32_t mx28_get_emiclk(void)  static uint32_t mx28_get_gpmiclk(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t clkctrl, clkseq, div;  	uint8_t clkfrac, frac; @@ -145,8 +145,8 @@ static uint32_t mx28_get_gpmiclk(void)   */  void mx28_set_ioclk(enum mxs_ioclock io, uint32_t freq)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t div;  	int io_reg; @@ -178,8 +178,8 @@ void mx28_set_ioclk(enum mxs_ioclock io, uint32_t freq)   */  static uint32_t mx28_get_ioclk(enum mxs_ioclock io)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint8_t ret;  	int io_reg; @@ -199,15 +199,15 @@ static uint32_t mx28_get_ioclk(enum mxs_ioclock io)   */  void mx28_set_sspclk(enum mxs_sspclock ssp, uint32_t freq, int xtal)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t clk, clkreg;  	if (ssp > MXC_SSPCLK3)  		return;  	clkreg = (uint32_t)(&clkctrl_regs->hw_clkctrl_ssp0) + -			(ssp * sizeof(struct mx28_register_32)); +			(ssp * sizeof(struct mxs_register_32));  	clrbits_le32(clkreg, CLKCTRL_SSP_CLKGATE);  	while (readl(clkreg) & CLKCTRL_SSP_CLKGATE) @@ -243,8 +243,8 @@ void mx28_set_sspclk(enum mxs_sspclock ssp, uint32_t freq, int xtal)   */  static uint32_t mx28_get_sspclk(enum mxs_sspclock ssp)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	uint32_t clkreg;  	uint32_t clk, tmp; @@ -256,7 +256,7 @@ static uint32_t mx28_get_sspclk(enum mxs_sspclock ssp)  		return XTAL_FREQ_KHZ;  	clkreg = (uint32_t)(&clkctrl_regs->hw_clkctrl_ssp0) + -			(ssp * sizeof(struct mx28_register_32)); +			(ssp * sizeof(struct mxs_register_32));  	tmp = readl(clkreg) & CLKCTRL_SSP_DIV_MASK; @@ -273,12 +273,12 @@ static uint32_t mx28_get_sspclk(enum mxs_sspclock ssp)   */  void mx28_set_ssp_busclock(unsigned int bus, uint32_t freq)  { -	struct mx28_ssp_regs *ssp_regs; +	struct mxs_ssp_regs *ssp_regs;  	const uint32_t sspclk = mx28_get_sspclk(bus);  	uint32_t reg;  	uint32_t divide, rate, tgtclk; -	ssp_regs = (struct mx28_ssp_regs *)(MXS_SSP0_BASE + (bus * 0x2000)); +	ssp_regs = (struct mxs_ssp_regs *)(MXS_SSP0_BASE + (bus * 0x2000));  	/*  	 * SSP bit rate = SSPCLK / (CLOCK_DIVIDE * (1 + CLOCK_RATE)), diff --git a/arch/arm/cpu/arm926ejs/mx28/iomux.c b/arch/arm/cpu/arm926ejs/mxs/iomux.c index 12916b6d6..73f144690 100644 --- a/arch/arm/cpu/arm926ejs/mx28/iomux.c +++ b/arch/arm/cpu/arm926ejs/mxs/iomux.c @@ -43,7 +43,7 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad)  {  	u32 reg, ofs, bp, bm;  	void *iomux_base = (void *)MXS_PINCTRL_BASE; -	struct mx28_register_32 *mxs_reg; +	struct mxs_register_32 *mxs_reg;  	/* muxsel */  	ofs = 0x100; @@ -70,7 +70,7 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad)  	/* vol */  	if (PAD_VOL_VALID(pad)) {  		bp = PAD_PIN(pad) % 8 * 4 + 2; -		mxs_reg = (struct mx28_register_32 *)(iomux_base + ofs); +		mxs_reg = (struct mxs_register_32 *)(iomux_base + ofs);  		if (PAD_VOL(pad))  			writel(1 << bp, &mxs_reg->reg_set);  		else @@ -82,7 +82,7 @@ int mxs_iomux_setup_pad(iomux_cfg_t pad)  		ofs = PULL_OFFSET;  		ofs += PAD_BANK(pad) * 0x10;  		bp = PAD_PIN(pad); -		mxs_reg = (struct mx28_register_32 *)(iomux_base + ofs); +		mxs_reg = (struct mxs_register_32 *)(iomux_base + ofs);  		if (PAD_PULL(pad))  			writel(1 << bp, &mxs_reg->reg_set);  		else diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c index ff2577209..6ce8019b8 100644 --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c @@ -41,8 +41,8 @@ DECLARE_GLOBAL_DATA_PTR;  /* 1 second delay should be plenty of time for block reset. */  #define	RESET_MAX_TIMEOUT	1000000 -#define	MX28_BLOCK_SFTRST	(1 << 31) -#define	MX28_BLOCK_CLKGATE	(1 << 30) +#define	MXS_BLOCK_SFTRST	(1 << 31) +#define	MXS_BLOCK_CLKGATE	(1 << 30)  /* Lowlevel init isn't used on i.MX28, so just have a dummy here */  inline void lowlevel_init(void) {} @@ -51,10 +51,10 @@ void reset_cpu(ulong ignored) __attribute__((noreturn));  void reset_cpu(ulong ignored)  { -	struct mx28_rtc_regs *rtc_regs = -		(struct mx28_rtc_regs *)MXS_RTC_BASE; -	struct mx28_lcdif_regs *lcdif_regs = -		(struct mx28_lcdif_regs *)MXS_LCDIF_BASE; +	struct mxs_rtc_regs *rtc_regs = +		(struct mxs_rtc_regs *)MXS_RTC_BASE; +	struct mxs_lcdif_regs *lcdif_regs = +		(struct mxs_lcdif_regs *)MXS_LCDIF_BASE;  	/*  	 * Shut down the LCD controller as it interferes with BootROM boot mode @@ -81,7 +81,8 @@ void enable_caches(void)  #endif  } -int mx28_wait_mask_set(struct mx28_register_32 *reg, uint32_t mask, int timeout) +int mxs_wait_mask_set(struct mxs_register_32 *reg, uint32_t mask, unsigned +								int timeout)  {  	while (--timeout) {  		if ((readl(®->reg) & mask) == mask) @@ -92,7 +93,8 @@ int mx28_wait_mask_set(struct mx28_register_32 *reg, uint32_t mask, int timeout)  	return !timeout;  } -int mx28_wait_mask_clr(struct mx28_register_32 *reg, uint32_t mask, int timeout) +int mxs_wait_mask_clr(struct mxs_register_32 *reg, uint32_t mask, unsigned +								int timeout)  {  	while (--timeout) {  		if ((readl(®->reg) & mask) == 0) @@ -103,34 +105,34 @@ int mx28_wait_mask_clr(struct mx28_register_32 *reg, uint32_t mask, int timeout)  	return !timeout;  } -int mx28_reset_block(struct mx28_register_32 *reg) +int mxs_reset_block(struct mxs_register_32 *reg)  {  	/* Clear SFTRST */ -	writel(MX28_BLOCK_SFTRST, ®->reg_clr); +	writel(MXS_BLOCK_SFTRST, ®->reg_clr); -	if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT)) +	if (mxs_wait_mask_clr(reg, MXS_BLOCK_SFTRST, RESET_MAX_TIMEOUT))  		return 1;  	/* Clear CLKGATE */ -	writel(MX28_BLOCK_CLKGATE, ®->reg_clr); +	writel(MXS_BLOCK_CLKGATE, ®->reg_clr);  	/* Set SFTRST */ -	writel(MX28_BLOCK_SFTRST, ®->reg_set); +	writel(MXS_BLOCK_SFTRST, ®->reg_set);  	/* Wait for CLKGATE being set */ -	if (mx28_wait_mask_set(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT)) +	if (mxs_wait_mask_set(reg, MXS_BLOCK_CLKGATE, RESET_MAX_TIMEOUT))  		return 1;  	/* Clear SFTRST */ -	writel(MX28_BLOCK_SFTRST, ®->reg_clr); +	writel(MXS_BLOCK_SFTRST, ®->reg_clr); -	if (mx28_wait_mask_clr(reg, MX28_BLOCK_SFTRST, RESET_MAX_TIMEOUT)) +	if (mxs_wait_mask_clr(reg, MXS_BLOCK_SFTRST, RESET_MAX_TIMEOUT))  		return 1;  	/* Clear CLKGATE */ -	writel(MX28_BLOCK_CLKGATE, ®->reg_clr); +	writel(MXS_BLOCK_CLKGATE, ®->reg_clr); -	if (mx28_wait_mask_clr(reg, MX28_BLOCK_CLKGATE, RESET_MAX_TIMEOUT)) +	if (mxs_wait_mask_clr(reg, MXS_BLOCK_CLKGATE, RESET_MAX_TIMEOUT))  		return 1;  	return 0; @@ -155,8 +157,8 @@ int arch_misc_init(void)  int arch_cpu_init(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	extern uint32_t _start;  	mx28_fixup_vt((uint32_t)&_start); @@ -188,14 +190,48 @@ int arch_cpu_init(void)  }  #if defined(CONFIG_DISPLAY_CPUINFO) +static const char *get_cpu_type(void) +{ +	struct mxs_digctl_regs *digctl_regs = +		(struct mxs_digctl_regs *)MXS_DIGCTL_BASE; + +	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) { +	case HW_DIGCTL_CHIPID_MX28: +		return "28"; +	default: +		return "??"; +	} +} + +static const char *get_cpu_rev(void) +{ +	struct mxs_digctl_regs *digctl_regs = +		(struct mxs_digctl_regs *)MXS_DIGCTL_BASE; +	uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF; + +	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) { +	case HW_DIGCTL_CHIPID_MX28: +		switch (rev) { +		case 0x1: +			return "1.2"; +		default: +			return "??"; +		} +	default: +		return "??"; +	} +} +  int print_cpuinfo(void)  { -	struct mx28_spl_data *data = (struct mx28_spl_data *) -		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf); +	struct mxs_spl_data *data = (struct mxs_spl_data *) +		((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf); -	printf("Freescale i.MX28 family at %d MHz\n", -			mxc_get_clock(MXC_ARM_CLK) / 1000000); -	printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode); +	printf("CPU:   Freescale i.MX%s rev%s at %d MHz\n", +		get_cpu_type(), +		get_cpu_rev(), +		mxc_get_clock(MXC_ARM_CLK) / 1000000); +	printf("BOOT:  %s\n", mxs_boot_modes[data->boot_mode_idx].mode);  	return 0;  }  #endif @@ -212,11 +248,11 @@ int do_mx28_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])  /*   * Initializes on-chip ethernet controllers.   */ -#ifdef	CONFIG_CMD_NET +#if defined(CONFIG_MX28) && defined(CONFIG_CMD_NET)  int cpu_eth_init(bd_t *bis)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	/* Turn on ENET clocks */  	clrbits_le32(&clkctrl_regs->hw_clkctrl_enet, @@ -257,15 +293,15 @@ void mx28_adjust_mac(int dev_id, unsigned char *mac)  #define	MXS_OCOTP_MAX_TIMEOUT	1000000  void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)  { -	struct mx28_ocotp_regs *ocotp_regs = -		(struct mx28_ocotp_regs *)MXS_OCOTP_BASE; +	struct mxs_ocotp_regs *ocotp_regs = +		(struct mxs_ocotp_regs *)MXS_OCOTP_BASE;  	uint32_t data;  	memset(mac, 0, 6);  	writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set); -	if (mx28_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY, +	if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,  				MXS_OCOTP_MAX_TIMEOUT)) {  		printf("MXS FEC: Can't get MAC from OCOTP\n");  		return; @@ -286,13 +322,13 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)  }  #endif -int mx28_dram_init(void) +int mxs_dram_init(void)  { -	struct mx28_spl_data *data = (struct mx28_spl_data *) -		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf); +	struct mxs_spl_data *data = (struct mxs_spl_data *) +		((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf);  	if (data->mem_dram_size == 0) { -		printf("MX28:\n" +		printf("MXS:\n"  			"Error, the RAM size passed up from SPL is 0!\n");  		hang();  	} diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28_init.h b/arch/arm/cpu/arm926ejs/mxs/mxs_init.h index e3a4493fb..2ddc5bc0c 100644 --- a/arch/arm/cpu/arm926ejs/mx28/mx28_init.h +++ b/arch/arm/cpu/arm926ejs/mxs/mxs_init.h @@ -28,18 +28,18 @@  void early_delay(int delay); -void mx28_power_init(void); +void mxs_power_init(void);  #ifdef	CONFIG_SPL_MX28_PSWITCH_WAIT -void mx28_power_wait_pswitch(void); +void mxs_power_wait_pswitch(void);  #else -static inline void mx28_power_wait_pswitch(void) { } +static inline void mxs_power_wait_pswitch(void) { }  #endif -void mx28_mem_init(void); -uint32_t mx28_mem_get_size(void); +void mxs_mem_init(void); +uint32_t mxs_mem_get_size(void); -void mx28_lradc_init(void); -void mx28_lradc_enable_batt_measurement(void); +void mxs_lradc_init(void); +void mxs_lradc_enable_batt_measurement(void);  #endif	/* __M28_INIT_H__ */ diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c index a6dfca3f5..ad66c57c5 100644 --- a/arch/arm/cpu/arm926ejs/mx28/spl_boot.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c @@ -26,12 +26,11 @@  #include <common.h>  #include <config.h>  #include <asm/io.h> -#include <asm/arch/iomux-mx28.h>  #include <asm/arch/imx-regs.h>  #include <asm/arch/sys_proto.h>  #include <asm/gpio.h> -#include "mx28_init.h" +#include "mxs_init.h"  /*   * This delay function is intended to be used only in early stage of boot, where @@ -39,12 +38,14 @@   * takes a few seconds to roll. The boot doesn't take that long, so to keep the   * code simple, it doesn't take rolling into consideration.   */ -#define	HW_DIGCTRL_MICROSECONDS	0x8001c0c0  void early_delay(int delay)  { -	uint32_t st = readl(HW_DIGCTRL_MICROSECONDS); +	struct mxs_digctl_regs *digctl_regs = +		(struct mxs_digctl_regs *)MXS_DIGCTL_BASE; + +	uint32_t st = readl(&digctl_regs->hw_digctl_microseconds);  	st += delay; -	while (st > readl(HW_DIGCTRL_MICROSECONDS)) +	while (st > readl(&digctl_regs->hw_digctl_microseconds))  		;  } @@ -58,7 +59,7 @@ const iomux_cfg_t iomux_boot[] = {  	MX28_PAD_LCD_D05__GPIO_1_5 | MUX_CONFIG_BOOTMODE_PAD,  }; -uint8_t mx28_get_bootmode_index(void) +uint8_t mxs_get_bootmode_index(void)  {  	uint8_t bootmode = 0;  	int i; @@ -83,31 +84,31 @@ uint8_t mx28_get_bootmode_index(void)  	bootmode |= (gpio_get_value(MX28_PAD_LCD_D04__GPIO_1_4) ? 1 : 0) << 4;  	bootmode |= (gpio_get_value(MX28_PAD_LCD_D05__GPIO_1_5) ? 1 : 0) << 5; -	for (i = 0; i < ARRAY_SIZE(mx28_boot_modes); i++) { -		masked = bootmode & mx28_boot_modes[i].boot_mask; -		if (masked == mx28_boot_modes[i].boot_pads) +	for (i = 0; i < ARRAY_SIZE(mxs_boot_modes); i++) { +		masked = bootmode & mxs_boot_modes[i].boot_mask; +		if (masked == mxs_boot_modes[i].boot_pads)  			break;  	}  	return i;  } -void mx28_common_spl_init(const iomux_cfg_t *iomux_setup, +void mxs_common_spl_init(const iomux_cfg_t *iomux_setup,  			const unsigned int iomux_size)  { -	struct mx28_spl_data *data = (struct mx28_spl_data *) -		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf); -	uint8_t bootmode = mx28_get_bootmode_index(); +	struct mxs_spl_data *data = (struct mxs_spl_data *) +		((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf); +	uint8_t bootmode = mxs_get_bootmode_index();  	mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size); -	mx28_power_init(); +	mxs_power_init(); -	mx28_mem_init(); -	data->mem_dram_size = mx28_mem_get_size(); +	mxs_mem_init(); +	data->mem_dram_size = mxs_mem_get_size();  	data->boot_mode_idx = bootmode; -	mx28_power_wait_pswitch(); +	mxs_power_wait_pswitch();  }  /* Support aparatus */ diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_lradc_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c index 88a603c11..d90f0a131 100644 --- a/arch/arm/cpu/arm926ejs/mx28/spl_lradc_init.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c @@ -28,11 +28,11 @@  #include <asm/io.h>  #include <asm/arch/imx-regs.h> -#include "mx28_init.h" +#include "mxs_init.h" -void mx28_lradc_init(void) +void mxs_lradc_init(void)  { -	struct mx28_lradc_regs *regs = (struct mx28_lradc_regs *)MXS_LRADC_BASE; +	struct mxs_lradc_regs *regs = (struct mxs_lradc_regs *)MXS_LRADC_BASE;  	writel(LRADC_CTRL0_SFTRST, ®s->hw_lradc_ctrl0_clr);  	writel(LRADC_CTRL0_CLKGATE, ®s->hw_lradc_ctrl0_clr); @@ -49,9 +49,9 @@ void mx28_lradc_init(void)  			LRADC_CTRL4_LRADC6SELECT_CHANNEL10);  } -void mx28_lradc_enable_batt_measurement(void) +void mxs_lradc_enable_batt_measurement(void)  { -	struct mx28_lradc_regs *regs = (struct mx28_lradc_regs *)MXS_LRADC_BASE; +	struct mxs_lradc_regs *regs = (struct mxs_lradc_regs *)MXS_LRADC_BASE;  	/* Check if the channel is present at all. */  	if (!(readl(®s->hw_lradc_status) & LRADC_STATUS_CHANNEL7_PRESENT)) diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c index e17a4d7c7..e693145b9 100644 --- a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c @@ -26,12 +26,11 @@  #include <common.h>  #include <config.h>  #include <asm/io.h> -#include <asm/arch/iomux-mx28.h>  #include <asm/arch/imx-regs.h> -#include "mx28_init.h" +#include "mxs_init.h" -uint32_t dram_vals[] = { +static uint32_t mx28_dram_vals[] = {  	0x00000000, 0x00000000, 0x00000000, 0x00000000,  	0x00000000, 0x00000000, 0x00000000, 0x00000000,  	0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -82,26 +81,26 @@ uint32_t dram_vals[] = {  	0x00000000, 0x00010001  }; -void __mx28_adjust_memory_params(uint32_t *dram_vals) +void __mxs_adjust_memory_params(uint32_t *dram_vals)  {  } -void mx28_adjust_memory_params(uint32_t *dram_vals) -	__attribute__((weak, alias("__mx28_adjust_memory_params"))); +void mxs_adjust_memory_params(uint32_t *dram_vals) +	__attribute__((weak, alias("__mxs_adjust_memory_params"))); -void init_m28_200mhz_ddr2(void) +void init_mx28_200mhz_ddr2(void)  {  	int i; -	mx28_adjust_memory_params(dram_vals); +	mxs_adjust_memory_params(mx28_dram_vals); -	for (i = 0; i < ARRAY_SIZE(dram_vals); i++) -		writel(dram_vals[i], MXS_DRAM_BASE + (4 * i)); +	for (i = 0; i < ARRAY_SIZE(mx28_dram_vals); i++) +		writel(mx28_dram_vals[i], MXS_DRAM_BASE + (4 * i));  } -void mx28_mem_init_clock(void) +void mxs_mem_init_clock(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	/* Gate EMI clock */  	writeb(CLKCTRL_FRAC_CLKGATE, @@ -129,10 +128,10 @@ void mx28_mem_init_clock(void)  	early_delay(10000);  } -void mx28_mem_setup_cpu_and_hbus(void) +void mxs_mem_setup_cpu_and_hbus(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	/* Set fractional divider for ref_cpu to 480 * 18 / 19 = 454MHz  	 * and ungate CPU clock */ @@ -161,10 +160,10 @@ void mx28_mem_setup_cpu_and_hbus(void)  	early_delay(15000);  } -void mx28_mem_setup_vdda(void) +void mxs_mem_setup_vdda(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	writel((0xc << POWER_VDDACTRL_TRG_OFFSET) |  		(0x7 << POWER_VDDACTRL_BO_OFFSET_OFFSET) | @@ -172,10 +171,10 @@ void mx28_mem_setup_vdda(void)  		&power_regs->hw_power_vddactrl);  } -void mx28_mem_setup_vddd(void) +void mxs_mem_setup_vddd(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	writel((0x1c << POWER_VDDDCTRL_TRG_OFFSET) |  		(0x7 << POWER_VDDDCTRL_BO_OFFSET_OFFSET) | @@ -183,7 +182,7 @@ void mx28_mem_setup_vddd(void)  		&power_regs->hw_power_vdddctrl);  } -uint32_t mx28_mem_get_size(void) +uint32_t mxs_mem_get_size(void)  {  	uint32_t sz, da;  	uint32_t *vt = (uint32_t *)0x20; @@ -202,12 +201,12 @@ uint32_t mx28_mem_get_size(void)  	return sz;  } -void mx28_mem_init(void) +void mxs_mem_init(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; -	struct mx28_pinctrl_regs *pinctrl_regs = -		(struct mx28_pinctrl_regs *)MXS_PINCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_pinctrl_regs *pinctrl_regs = +		(struct mxs_pinctrl_regs *)MXS_PINCTRL_BASE;  	/* Set DDR2 mode */  	writel(PINCTRL_EMI_DS_CTRL_DDR_MODE_DDR2, @@ -219,9 +218,9 @@ void mx28_mem_init(void)  	early_delay(11000); -	mx28_mem_init_clock(); +	mxs_mem_init_clock(); -	mx28_mem_setup_vdda(); +	mxs_mem_setup_vdda();  	/*  	 * Configure the DRAM registers @@ -230,7 +229,7 @@ void mx28_mem_init(void)  	/* Clear START bit from DRAM_CTL16 */  	clrbits_le32(MXS_DRAM_BASE + 0x40, 1); -	init_m28_200mhz_ddr2(); +	init_mx28_200mhz_ddr2();  	/* Clear SREFRESH bit from DRAM_CTL17 */  	clrbits_le32(MXS_DRAM_BASE + 0x44, 1); @@ -242,9 +241,9 @@ void mx28_mem_init(void)  	while (!(readl(MXS_DRAM_BASE + 0xe8) & (1 << 20)))  		; -	mx28_mem_setup_vddd(); +	mxs_mem_setup_vddd();  	early_delay(10000); -	mx28_mem_setup_cpu_and_hbus(); +	mxs_mem_setup_cpu_and_hbus();  } diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c index 4b09b0c3b..4b917bd18 100644 --- a/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c @@ -28,22 +28,22 @@  #include <asm/io.h>  #include <asm/arch/imx-regs.h> -#include "mx28_init.h" +#include "mxs_init.h" -void mx28_power_clock2xtal(void) +void mxs_power_clock2xtal(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	/* Set XTAL as CPU reference clock */  	writel(CLKCTRL_CLKSEQ_BYPASS_CPU,  		&clkctrl_regs->hw_clkctrl_clkseq_set);  } -void mx28_power_clock2pll(void) +void mxs_power_clock2pll(void)  { -	struct mx28_clkctrl_regs *clkctrl_regs = -		(struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; +	struct mxs_clkctrl_regs *clkctrl_regs = +		(struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;  	setbits_le32(&clkctrl_regs->hw_clkctrl_pll0ctrl0,  			CLKCTRL_PLL0CTRL0_POWER); @@ -52,10 +52,10 @@ void mx28_power_clock2pll(void)  			CLKCTRL_CLKSEQ_BYPASS_CPU);  } -void mx28_power_clear_auto_restart(void) +void mxs_power_clear_auto_restart(void)  { -	struct mx28_rtc_regs *rtc_regs = -		(struct mx28_rtc_regs *)MXS_RTC_BASE; +	struct mxs_rtc_regs *rtc_regs = +		(struct mxs_rtc_regs *)MXS_RTC_BASE;  	writel(RTC_CTRL_SFTRST, &rtc_regs->hw_rtc_ctrl_clr);  	while (readl(&rtc_regs->hw_rtc_ctrl) & RTC_CTRL_SFTRST) @@ -85,10 +85,10 @@ void mx28_power_clear_auto_restart(void)  		;  } -void mx28_power_set_linreg(void) +void mxs_power_set_linreg(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/* Set linear regulator 25mV below switching converter */  	clrsetbits_le32(&power_regs->hw_power_vdddctrl, @@ -104,10 +104,10 @@ void mx28_power_set_linreg(void)  			POWER_VDDIOCTRL_LINREG_OFFSET_1STEPS_BELOW);  } -int mx28_get_batt_volt(void) +int mxs_get_batt_volt(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t volt = readl(&power_regs->hw_power_battmonitor);  	volt &= POWER_BATTMONITOR_BATT_VAL_MASK;  	volt >>= POWER_BATTMONITOR_BATT_VAL_OFFSET; @@ -115,16 +115,16 @@ int mx28_get_batt_volt(void)  	return volt;  } -int mx28_is_batt_ready(void) +int mxs_is_batt_ready(void)  { -	return (mx28_get_batt_volt() >= 3600); +	return (mxs_get_batt_volt() >= 3600);  } -int mx28_is_batt_good(void) +int mxs_is_batt_good(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; -	uint32_t volt = mx28_get_batt_volt(); +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE; +	uint32_t volt = mxs_get_batt_volt();  	if ((volt >= 2400) && (volt <= 4300))  		return 1; @@ -145,7 +145,7 @@ int mx28_is_batt_good(void)  	early_delay(500000); -	volt = mx28_get_batt_volt(); +	volt = mxs_get_batt_volt();  	if (volt >= 3500)  		return 0; @@ -160,10 +160,10 @@ int mx28_is_batt_good(void)  	return 0;  } -void mx28_power_setup_5v_detect(void) +void mxs_power_setup_5v_detect(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/* Start 5V detection */  	clrsetbits_le32(&power_regs->hw_power_5vctrl, @@ -172,10 +172,10 @@ void mx28_power_setup_5v_detect(void)  			POWER_5VCTRL_PWRUP_VBUS_CMPS);  } -void mx28_src_power_init(void) +void mxs_src_power_init(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/* Improve efficieny and reduce transient ripple */  	writel(POWER_LOOPCTRL_TOGGLE_DIF | POWER_LOOPCTRL_EN_CM_HYST | @@ -203,10 +203,10 @@ void mx28_src_power_init(void)  	clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);  } -void mx28_power_init_4p2_params(void) +void mxs_power_init_4p2_params(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/* Setup 4P2 parameters */  	clrsetbits_le32(&power_regs->hw_power_dcdc4p2, @@ -227,10 +227,10 @@ void mx28_power_init_4p2_params(void)  		0x3f << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);  } -void mx28_enable_4p2_dcdc_input(int xfer) +void mxs_enable_4p2_dcdc_input(int xfer)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t tmp, vbus_thresh, vbus_5vdetect, pwd_bo;  	uint32_t prev_5v_brnout, prev_5v_droop; @@ -323,10 +323,10 @@ void mx28_enable_4p2_dcdc_input(int xfer)  				POWER_CTRL_ENIRQ_VDD5V_DROOP);  } -void mx28_power_init_4p2_regulator(void) +void mxs_power_init_4p2_regulator(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t tmp, tmp2;  	setbits_le32(&power_regs->hw_power_dcdc4p2, POWER_DCDC4P2_ENABLE_4P2); @@ -346,7 +346,7 @@ void mx28_power_init_4p2_regulator(void)  	 * gradually to avoid large inrush current from the 5V cable which can  	 * cause transients/problems  	 */ -	mx28_enable_4p2_dcdc_input(0); +	mxs_enable_4p2_dcdc_input(0);  	if (readl(&power_regs->hw_power_ctrl) & POWER_CTRL_VBUS_VALID_IRQ) {  		/* @@ -407,17 +407,17 @@ void mx28_power_init_4p2_regulator(void)  	writel(POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);  } -void mx28_power_init_dcdc_4p2_source(void) +void mxs_power_init_dcdc_4p2_source(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	if (!(readl(&power_regs->hw_power_dcdc4p2) &  		POWER_DCDC4P2_ENABLE_DCDC)) {  		hang();  	} -	mx28_enable_4p2_dcdc_input(1); +	mxs_enable_4p2_dcdc_input(1);  	if (readl(&power_regs->hw_power_ctrl) & POWER_CTRL_VBUS_VALID_IRQ) {  		clrbits_le32(&power_regs->hw_power_dcdc4p2, @@ -429,10 +429,10 @@ void mx28_power_init_dcdc_4p2_source(void)  	}  } -void mx28_power_enable_4p2(void) +void mxs_power_enable_4p2(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t vdddctrl, vddactrl, vddioctrl;  	uint32_t tmp; @@ -451,11 +451,11 @@ void mx28_power_enable_4p2(void)  	setbits_le32(&power_regs->hw_power_vddioctrl,  		POWER_VDDIOCTRL_DISABLE_FET | POWER_VDDIOCTRL_PWDN_BRNOUT); -	mx28_power_init_4p2_params(); -	mx28_power_init_4p2_regulator(); +	mxs_power_init_4p2_params(); +	mxs_power_init_4p2_regulator();  	/* Shutdown battery (none present) */ -	if (!mx28_is_batt_ready()) { +	if (!mxs_is_batt_ready()) {  		clrbits_le32(&power_regs->hw_power_dcdc4p2,  				POWER_DCDC4P2_BO_MASK);  		writel(POWER_CTRL_DCDC4P2_BO_IRQ, @@ -464,7 +464,7 @@ void mx28_power_enable_4p2(void)  				&power_regs->hw_power_ctrl_clr);  	} -	mx28_power_init_dcdc_4p2_source(); +	mxs_power_init_dcdc_4p2_source();  	writel(vdddctrl, &power_regs->hw_power_vdddctrl);  	early_delay(20); @@ -488,10 +488,10 @@ void mx28_power_enable_4p2(void)  			&power_regs->hw_power_charge_clr);  } -void mx28_boot_valid_5v(void) +void mxs_boot_valid_5v(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/*  	 * Use VBUSVALID level instead of VDD5V_GT_VDDIO level to trigger a 5V @@ -508,22 +508,22 @@ void mx28_boot_valid_5v(void)  	writel(POWER_CTRL_VBUS_VALID_IRQ | POWER_CTRL_VDD5V_GT_VDDIO_IRQ,  		&power_regs->hw_power_ctrl_clr); -	mx28_power_enable_4p2(); +	mxs_power_enable_4p2();  } -void mx28_powerdown(void) +void mxs_powerdown(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	writel(POWER_RESET_UNLOCK_KEY, &power_regs->hw_power_reset);  	writel(POWER_RESET_UNLOCK_KEY | POWER_RESET_PWD_OFF,  		&power_regs->hw_power_reset);  } -void mx28_batt_boot(void) +void mxs_batt_boot(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_PWDN_5VBRNOUT);  	clrbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_ENABLE_DCDC); @@ -542,7 +542,7 @@ void mx28_batt_boot(void)  	clrsetbits_le32(&power_regs->hw_power_minpwr,  			POWER_MINPWR_HALFFETS, POWER_MINPWR_DOUBLE_FETS); -	mx28_power_set_linreg(); +	mxs_power_set_linreg();  	clrbits_le32(&power_regs->hw_power_vdddctrl,  		POWER_VDDDCTRL_DISABLE_FET | POWER_VDDDCTRL_ENABLE_LINREG); @@ -564,10 +564,10 @@ void mx28_batt_boot(void)  		0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);  } -void mx28_handle_5v_conflict(void) +void mxs_handle_5v_conflict(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t tmp;  	setbits_le32(&power_regs->hw_power_vddioctrl, @@ -577,52 +577,56 @@ void mx28_handle_5v_conflict(void)  		tmp = readl(&power_regs->hw_power_sts);  		if (tmp & POWER_STS_VDDIO_BO) { -			mx28_powerdown(); +			/* +			 * VDDIO has a brownout, then the VDD5V_GT_VDDIO becomes +			 * unreliable +			 */ +			mxs_powerdown();  			break;  		}  		if (tmp & POWER_STS_VDD5V_GT_VDDIO) { -			mx28_boot_valid_5v(); +			mxs_boot_valid_5v();  			break;  		} else { -			mx28_powerdown(); +			mxs_powerdown();  			break;  		}  		if (tmp & POWER_STS_PSWITCH_MASK) { -			mx28_batt_boot(); +			mxs_batt_boot();  			break;  		}  	}  } -void mx28_5v_boot(void) +void mxs_5v_boot(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/*  	 * NOTE: In original IMX-Bootlets, this also checks for VBUSVALID,  	 * but their implementation always returns 1 so we omit it here.  	 */  	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) { -		mx28_boot_valid_5v(); +		mxs_boot_valid_5v();  		return;  	}  	early_delay(1000);  	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) { -		mx28_boot_valid_5v(); +		mxs_boot_valid_5v();  		return;  	} -	mx28_handle_5v_conflict(); +	mxs_handle_5v_conflict();  } -void mx28_init_batt_bo(void) +void mxs_init_batt_bo(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	/* Brownout at 3V */  	clrsetbits_le32(&power_regs->hw_power_battmonitor, @@ -633,10 +637,10 @@ void mx28_init_batt_bo(void)  	writel(POWER_CTRL_ENIRQ_BATT_BO, &power_regs->hw_power_ctrl_clr);  } -void mx28_switch_vddd_to_dcdc_source(void) +void mxs_switch_vddd_to_dcdc_source(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	clrsetbits_le32(&power_regs->hw_power_vdddctrl,  		POWER_VDDDCTRL_LINREG_OFFSET_MASK, @@ -647,51 +651,48 @@ void mx28_switch_vddd_to_dcdc_source(void)  		POWER_VDDDCTRL_DISABLE_STEPPING);  } -void mx28_power_configure_power_source(void) +void mxs_power_configure_power_source(void)  {  	int batt_ready, batt_good; -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; -	struct mx28_lradc_regs *lradc_regs = -		(struct mx28_lradc_regs *)MXS_LRADC_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE; +	struct mxs_lradc_regs *lradc_regs = +		(struct mxs_lradc_regs *)MXS_LRADC_BASE; -	mx28_src_power_init(); - -	batt_ready = mx28_is_batt_ready(); +	mxs_src_power_init();  	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) { -		batt_good = mx28_is_batt_good(); +		batt_ready = mxs_is_batt_ready();  		if (batt_ready) {  			/* 5V source detected, good battery detected. */ -			mx28_batt_boot(); +			mxs_batt_boot();  		} else { -			if (batt_good) { -				/* 5V source detected, low battery detceted. */ -			} else { +			batt_good = mxs_is_batt_good(); +			if (!batt_good) {  				/* 5V source detected, bad battery detected. */  				writel(LRADC_CONVERSION_AUTOMATIC,  					&lradc_regs->hw_lradc_conversion_clr);  				clrbits_le32(&power_regs->hw_power_battmonitor,  					POWER_BATTMONITOR_BATT_VAL_MASK);  			} -			mx28_5v_boot(); +			mxs_5v_boot();  		}  	} else {  		/* 5V not detected, booting from battery. */ -		mx28_batt_boot(); +		mxs_batt_boot();  	} -	mx28_power_clock2pll(); +	mxs_power_clock2pll(); -	mx28_init_batt_bo(); +	mxs_init_batt_bo(); -	mx28_switch_vddd_to_dcdc_source(); +	mxs_switch_vddd_to_dcdc_source();  } -void mx28_enable_output_rail_protection(void) +void mxs_enable_output_rail_protection(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ |  		POWER_CTRL_VDDIO_BO_IRQ, &power_regs->hw_power_ctrl_clr); @@ -706,17 +707,17 @@ void mx28_enable_output_rail_protection(void)  			POWER_VDDIOCTRL_PWDN_BRNOUT);  } -int mx28_get_vddio_power_source_off(void) +int mxs_get_vddio_power_source_off(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t tmp;  	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {  		tmp = readl(&power_regs->hw_power_vddioctrl);  		if (tmp & POWER_VDDIOCTRL_DISABLE_FET) {  			if ((tmp & POWER_VDDIOCTRL_LINREG_OFFSET_MASK) == -				POWER_VDDDCTRL_LINREG_OFFSET_0STEPS) { +				POWER_VDDIOCTRL_LINREG_OFFSET_0STEPS) {  				return 1;  			}  		} @@ -724,7 +725,7 @@ int mx28_get_vddio_power_source_off(void)  		if (!(readl(&power_regs->hw_power_5vctrl) &  			POWER_5VCTRL_ENABLE_DCDC)) {  			if ((tmp & POWER_VDDIOCTRL_LINREG_OFFSET_MASK) == -				POWER_VDDDCTRL_LINREG_OFFSET_0STEPS) { +				POWER_VDDIOCTRL_LINREG_OFFSET_0STEPS) {  				return 1;  			}  		} @@ -734,10 +735,10 @@ int mx28_get_vddio_power_source_off(void)  } -int mx28_get_vddd_power_source_off(void) +int mxs_get_vddd_power_source_off(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t tmp;  	tmp = readl(&power_regs->hw_power_vdddctrl); @@ -765,21 +766,21 @@ int mx28_get_vddd_power_source_off(void)  	return 0;  } -void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout) +void mxs_power_set_vddio(uint32_t new_target, uint32_t new_brownout)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t cur_target, diff, bo_int = 0;  	uint32_t powered_by_linreg = 0; -	new_brownout = new_target - new_brownout; +	new_brownout = (new_target - new_brownout + 25) / 50;  	cur_target = readl(&power_regs->hw_power_vddioctrl);  	cur_target &= POWER_VDDIOCTRL_TRG_MASK;  	cur_target *= 50;	/* 50 mV step*/  	cur_target += 2800;	/* 2800 mV lowest */ -	powered_by_linreg = mx28_get_vddio_power_source_off(); +	powered_by_linreg = mxs_get_vddio_power_source_off();  	if (new_target > cur_target) {  		if (powered_by_linreg) { @@ -858,25 +859,25 @@ void mx28_power_set_vddio(uint32_t new_target, uint32_t new_brownout)  	}  	clrsetbits_le32(&power_regs->hw_power_vddioctrl, -			POWER_VDDDCTRL_BO_OFFSET_MASK, -			new_brownout << POWER_VDDDCTRL_BO_OFFSET_OFFSET); +			POWER_VDDIOCTRL_BO_OFFSET_MASK, +			new_brownout << POWER_VDDIOCTRL_BO_OFFSET_OFFSET);  } -void mx28_power_set_vddd(uint32_t new_target, uint32_t new_brownout) +void mxs_power_set_vddd(uint32_t new_target, uint32_t new_brownout)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	uint32_t cur_target, diff, bo_int = 0;  	uint32_t powered_by_linreg = 0; -	new_brownout = new_target - new_brownout; +	new_brownout = (new_target - new_brownout + 12) / 25;  	cur_target = readl(&power_regs->hw_power_vdddctrl);  	cur_target &= POWER_VDDDCTRL_TRG_MASK;  	cur_target *= 25;	/* 25 mV step*/  	cur_target += 800;	/* 800 mV lowest */ -	powered_by_linreg = mx28_get_vddd_power_source_off(); +	powered_by_linreg = mxs_get_vddd_power_source_off();  	if (new_target > cur_target) {  		if (powered_by_linreg) {  			bo_int = readl(&power_regs->hw_power_vdddctrl); @@ -959,31 +960,31 @@ void mx28_power_set_vddd(uint32_t new_target, uint32_t new_brownout)  			new_brownout << POWER_VDDDCTRL_BO_OFFSET_OFFSET);  } -void mx28_setup_batt_detect(void) +void mxs_setup_batt_detect(void)  { -	mx28_lradc_init(); -	mx28_lradc_enable_batt_measurement(); +	mxs_lradc_init(); +	mxs_lradc_enable_batt_measurement();  	early_delay(10);  } -void mx28_power_init(void) +void mxs_power_init(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE; -	mx28_power_clock2xtal(); -	mx28_power_clear_auto_restart(); -	mx28_power_set_linreg(); -	mx28_power_setup_5v_detect(); +	mxs_power_clock2xtal(); +	mxs_power_clear_auto_restart(); +	mxs_power_set_linreg(); +	mxs_power_setup_5v_detect(); -	mx28_setup_batt_detect(); +	mxs_setup_batt_detect(); -	mx28_power_configure_power_source(); -	mx28_enable_output_rail_protection(); +	mxs_power_configure_power_source(); +	mxs_enable_output_rail_protection(); -	mx28_power_set_vddio(3300, 3150); +	mxs_power_set_vddio(3300, 3150); -	mx28_power_set_vddd(1350, 1200); +	mxs_power_set_vddd(1350, 1200);  	writel(POWER_CTRL_VDDD_BO_IRQ | POWER_CTRL_VDDA_BO_IRQ |  		POWER_CTRL_VDDIO_BO_IRQ | POWER_CTRL_VDD5V_DROOP_IRQ | @@ -996,10 +997,10 @@ void mx28_power_init(void)  }  #ifdef	CONFIG_SPL_MX28_PSWITCH_WAIT -void mx28_power_wait_pswitch(void) +void mxs_power_wait_pswitch(void)  { -	struct mx28_power_regs *power_regs = -		(struct mx28_power_regs *)MXS_POWER_BASE; +	struct mxs_power_regs *power_regs = +		(struct mxs_power_regs *)MXS_POWER_BASE;  	while (!(readl(&power_regs->hw_power_sts) & POWER_STS_PSWITCH_MASK))  		; diff --git a/arch/arm/cpu/arm926ejs/mx28/start.S b/arch/arm/cpu/arm926ejs/mxs/start.S index e572b786b..7ccd33717 100644 --- a/arch/arm/cpu/arm926ejs/mx28/start.S +++ b/arch/arm/cpu/arm926ejs/mxs/start.S @@ -180,14 +180,6 @@ _reset:  	orr	r0,r0,#0xd3  	msr	cpsr,r0 -	/* -	 * we do sys-critical inits only at reboot, -	 * not when booting from ram! -	 */ -#ifndef CONFIG_SKIP_LOWLEVEL_INIT -	bl	cpu_init_crit -#endif -  	bl	board_init_ll  	/* @@ -207,40 +199,6 @@ _reset:  	pop	{r0-r12,r14}  	bx	lr -/* - ************************************************************************* - * - * CPU_init_critical registers - * - * setup important registers - * setup memory timing - * - ************************************************************************* - */ -#ifndef CONFIG_SKIP_LOWLEVEL_INIT -cpu_init_crit: -	/* -	 * flush v4 I/D caches -	 */ -	mov	r0, #0 -	mcr	p15, 0, r0, c7, c7, 0	/* flush v3/v4 cache */ -	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */ - -	/* -	 * disable MMU stuff and caches -	 */ -	mrc	p15, 0, r0, c1, c0, 0 -	bic	r0, r0, #0x00002300	/* clear bits 13, 9:8 (--V- --RS) */ -	bic	r0, r0, #0x00000087	/* clear bits 7, 2:0 (B--- -CAM) */ -	orr	r0, r0, #0x00000002	/* set bit 2 (A) Align */ -	orr	r0, r0, #0x00001000	/* set bit 12 (I) I-Cache */ -	mcr	p15, 0, r0, c1, c0, 0 - -	mov	pc, lr		/* back to my caller */ - -	.align	5 -#endif /* CONFIG_SKIP_LOWLEVEL_INIT */ -  _hang:  	ldr	sp, _TEXT_BASE			/* switch to abort stack */  1: diff --git a/arch/arm/cpu/arm926ejs/mx28/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c index 5b73f4a2b..4ed75e604 100644 --- a/arch/arm/cpu/arm926ejs/mx28/timer.c +++ b/arch/arm/cpu/arm926ejs/mxs/timer.c @@ -62,11 +62,11 @@ static inline unsigned long us_to_tick(unsigned long us)  int timer_init(void)  { -	struct mx28_timrot_regs *timrot_regs = -		(struct mx28_timrot_regs *)MXS_TIMROT_BASE; +	struct mxs_timrot_regs *timrot_regs = +		(struct mxs_timrot_regs *)MXS_TIMROT_BASE;  	/* Reset Timers and Rotary Encoder module */ -	mx28_reset_block(&timrot_regs->hw_timrot_rotctrl_reg); +	mxs_reset_block(&timrot_regs->hw_timrot_rotctrl_reg);  	/* Set fixed_count to 0 */  	writel(0, &timrot_regs->hw_timrot_fixed_count0); @@ -84,8 +84,8 @@ int timer_init(void)  unsigned long long get_ticks(void)  { -	struct mx28_timrot_regs *timrot_regs = -		(struct mx28_timrot_regs *)MXS_TIMROT_BASE; +	struct mxs_timrot_regs *timrot_regs = +		(struct mxs_timrot_regs *)MXS_TIMROT_BASE;  	/* Current tick value */  	uint32_t now = readl(&timrot_regs->hw_timrot_running_count0); diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd b/arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd new file mode 100644 index 000000000..c60615a45 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd @@ -0,0 +1,14 @@ +sources { +	u_boot_spl="spl/u-boot-spl.bin"; +	u_boot="u-boot.bin"; +} + +section (0) { +	load u_boot_spl > 0x0000; +	load ivt (entry = 0x0014) > 0x8000; +	hab call 0x8000; + +	load u_boot > 0x40000100; +	load ivt (entry = 0x40000100) > 0x8000; +	hab call 0x8000; +} diff --git a/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds index 0fccd5296..f8ea38c03 100644 --- a/arch/arm/cpu/arm926ejs/mx28/u-boot-spl.lds +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds @@ -37,7 +37,7 @@ SECTIONS  	. = ALIGN(4);  	.text	:  	{ -		arch/arm/cpu/arm926ejs/mx28/start.o	(.text) +		arch/arm/cpu/arm926ejs/mxs/start.o	(.text)  		*(.text)  	} diff --git a/arch/arm/cpu/arm926ejs/orion5x/cpu.c b/arch/arm/cpu/arm926ejs/orion5x/cpu.c index 792b11dfc..c3948d38f 100644 --- a/arch/arm/cpu/arm926ejs/orion5x/cpu.c +++ b/arch/arm/cpu/arm926ejs/orion5x/cpu.c @@ -292,7 +292,9 @@ int arch_misc_init(void)  	writel(ORION5X_MPP0_7, ORION5X_MPP_BASE+0x00);  	writel(ORION5X_MPP8_15, ORION5X_MPP_BASE+0x04);  	writel(ORION5X_MPP16_23, ORION5X_MPP_BASE+0x50); +	writel(ORION5X_GPIO_OUT_VALUE, ORION5X_GPIO_BASE+0x00);  	writel(ORION5X_GPIO_OUT_ENABLE, ORION5X_GPIO_BASE+0x04); +	writel(ORION5X_GPIO_IN_POLARITY, ORION5X_GPIO_BASE+0x0c);  	/* initialize timer */  	timer_init_r(); diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index 6b2addca1..4fdbee4bc 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -32,8 +32,12 @@ COBJS	+= cache_v7.o  COBJS	+= cpu.o  COBJS	+= syslib.o +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),) +SOBJS	+= lowlevel_init.o +endif +  SRCS	:= $(START:.o=.S) $(COBJS:.o=.c) -OBJS	:= $(addprefix $(obj),$(COBJS)) +OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))  START	:= $(addprefix $(obj),$(START))  all:	$(obj).depend $(START) $(LIB) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 71309a7f4..ecc26717c 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -17,22 +17,100 @@   */  #include <common.h> +#include <errno.h>  #include <asm/arch/cpu.h>  #include <asm/arch/hardware.h>  #include <asm/arch/omap.h>  #include <asm/arch/ddr_defs.h>  #include <asm/arch/clock.h> +#include <asm/arch/gpio.h>  #include <asm/arch/mmc_host_def.h> -#include <asm/arch/common_def.h> +#include <asm/arch/sys_proto.h>  #include <asm/io.h>  #include <asm/omap_common.h> +#include <asm/emif.h> +#include <asm/gpio.h> +#include <i2c.h> +#include <miiphy.h> +#include <cpsw.h>  DECLARE_GLOBAL_DATA_PTR;  struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE; -struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;  struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE; +static const struct gpio_bank gpio_bank_am33xx[4] = { +	{ (void *)AM33XX_GPIO0_BASE, METHOD_GPIO_24XX }, +	{ (void *)AM33XX_GPIO1_BASE, METHOD_GPIO_24XX }, +	{ (void *)AM33XX_GPIO2_BASE, METHOD_GPIO_24XX }, +	{ (void *)AM33XX_GPIO3_BASE, METHOD_GPIO_24XX }, +}; + +const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx; + +/* MII mode defines */ +#define MII_MODE_ENABLE		0x0 +#define RGMII_MODE_ENABLE	0xA + +/* GPIO that controls power to DDR on EVM-SK */ +#define GPIO_DDR_VTT_EN		7 + +static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; + +static struct am335x_baseboard_id __attribute__((section (".data"))) header; + +static inline int board_is_bone(void) +{ +	return !strncmp(header.name, "A335BONE", HDR_NAME_LEN); +} + +static inline int board_is_evm_sk(void) +{ +	return !strncmp("A335X_SK", header.name, HDR_NAME_LEN); +} + +/* + * Read header information from EEPROM into global structure. + */ +static int read_eeprom(void) +{ +	/* Check if baseboard eeprom is available */ +	if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) { +		puts("Could not probe the EEPROM; something fundamentally " +			"wrong on the I2C bus.\n"); +		return -ENODEV; +	} + +	/* read the eeprom using i2c */ +	if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)&header, +							sizeof(header))) { +		puts("Could not read the EEPROM; something fundamentally" +			" wrong on the I2C bus.\n"); +		return -EIO; +	} + +	if (header.magic != 0xEE3355AA) { +		/* +		 * read the eeprom using i2c again, +		 * but use only a 1 byte address +		 */ +		if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, +					(uchar *)&header, sizeof(header))) { +			puts("Could not read the EEPROM; something " +				"fundamentally wrong on the I2C bus.\n"); +			return -EIO; +		} + +		if (header.magic != 0xEE3355AA) { +			printf("Incorrect magic number (0x%x) in EEPROM\n", +					header.magic); +			return -EINVAL; +		} +	} + +	return 0; +} +  /* UART Defines */  #ifdef CONFIG_SPL_BUILD  #define UART_RESET		(0x1 << 1) @@ -40,21 +118,17 @@ struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;  #define UART_SMART_IDLE_EN	(0x1 << 0x3)  #endif -#ifdef CONFIG_SPL_BUILD -/* Initialize timer */ -static void init_timer(void) +/* + * Determine what type of DDR we have. + */ +static short inline board_memory_type(void)  { -	/* Reset the Timer */ -	writel(0x2, (&timer_base->tscir)); +	/* The following boards are known to use DDR3. */ +	if (board_is_evm_sk()) +		return EMIF_REG_SDRAM_TYPE_DDR3; -	/* Wait until the reset is done */ -	while (readl(&timer_base->tiocp_cfg) & 1) -		; - -	/* Start the Timer */ -	writel(0x1, (&timer_base->tclr)); +	return EMIF_REG_SDRAM_TYPE_DDR2;  } -#endif  /*   * early system init of muxing and clocks. @@ -92,22 +166,38 @@ void s_init(void)  	regVal |= UART_SMART_IDLE_EN;  	writel(regVal, &uart_base->uartsyscfg); -	/* Initialize the Timer */ -	init_timer(); -  	preloader_console_init(); -	config_ddr(); -#endif +	/* Initalize the board header */ +	enable_i2c0_pin_mux(); +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); +	if (read_eeprom() < 0) +		puts("Could not get board ID.\n"); -	/* Enable MMC0 */ -	enable_mmc0_pin_mux(); +	enable_board_pin_mux(&header); +	if (board_is_evm_sk()) { +		/* +		 * EVM SK 1.2A and later use gpio0_7 to enable DDR3. +		 * This is safe enough to do on older revs. +		 */ +		gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en"); +		gpio_direction_output(GPIO_DDR_VTT_EN, 1); +	} + +	config_ddr(board_memory_type()); +#endif  }  #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)  int board_mmc_init(bd_t *bis)  { -	return omap_mmc_init(0, 0, 0); +	int ret; +	 +	ret = omap_mmc_init(0, 0, 0); +	if (ret) +		return ret; + +	return omap_mmc_init(1, 0, 0);  }  #endif @@ -116,3 +206,93 @@ void setup_clocks_for_console(void)  	/* Not yet implemented */  	return;  } + +/* + * Basic board specific setup.  Pinmux has been handled already. + */ +int board_init(void) +{ +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); +	if (read_eeprom() < 0) +		puts("Could not get board ID.\n"); + +	gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100; + +	return 0; +} + +#ifdef CONFIG_DRIVER_TI_CPSW +static void cpsw_control(int enabled) +{ +	/* VTP can be added here */ + +	return; +} + +static struct cpsw_slave_data cpsw_slaves[] = { +	{ +		.slave_reg_ofs	= 0x208, +		.sliver_reg_ofs	= 0xd80, +		.phy_id		= 0, +	}, +	{ +		.slave_reg_ofs	= 0x308, +		.sliver_reg_ofs	= 0xdc0, +		.phy_id		= 1, +	}, +}; + +static struct cpsw_platform_data cpsw_data = { +	.mdio_base		= AM335X_CPSW_MDIO_BASE, +	.cpsw_base		= AM335X_CPSW_BASE, +	.mdio_div		= 0xff, +	.channels		= 8, +	.cpdma_reg_ofs		= 0x800, +	.slaves			= 1, +	.slave_data		= cpsw_slaves, +	.ale_reg_ofs		= 0xd00, +	.ale_entries		= 1024, +	.host_port_reg_ofs	= 0x108, +	.hw_stats_reg_ofs	= 0x900, +	.mac_control		= (1 << 5), +	.control		= cpsw_control, +	.host_port_num		= 0, +	.version		= CPSW_CTRL_VERSION_2, +}; + +int board_eth_init(bd_t *bis) +{ +	uint8_t mac_addr[6]; +	uint32_t mac_hi, mac_lo; + +	if (!eth_getenv_enetaddr("ethaddr", mac_addr)) { +		debug("<ethaddr> not set. Reading from E-fuse\n"); +		/* try reading mac address from efuse */ +		mac_lo = readl(&cdev->macid0l); +		mac_hi = readl(&cdev->macid0h); +		mac_addr[0] = mac_hi & 0xFF; +		mac_addr[1] = (mac_hi & 0xFF00) >> 8; +		mac_addr[2] = (mac_hi & 0xFF0000) >> 16; +		mac_addr[3] = (mac_hi & 0xFF000000) >> 24; +		mac_addr[4] = mac_lo & 0xFF; +		mac_addr[5] = (mac_lo & 0xFF00) >> 8; + +		if (is_valid_ether_addr(mac_addr)) +			eth_setenv_enetaddr("ethaddr", mac_addr); +		else +			return -1; +	} + +	if (board_is_bone()) { +		writel(MII_MODE_ENABLE, &cdev->miisel); +		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = +				PHY_INTERFACE_MODE_MII; +	} else { +		writel(RGMII_MODE_ENABLE, &cdev->miisel); +		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = +				PHY_INTERFACE_MODE_RGMII; +	} + +	return cpsw_register(&cpsw_data); +} +#endif diff --git a/arch/arm/cpu/armv7/am33xx/clock.c b/arch/arm/cpu/armv7/am33xx/clock.c index bbb9c1353..2b19506a3 100644 --- a/arch/arm/cpu/armv7/am33xx/clock.c +++ b/arch/arm/cpu/armv7/am33xx/clock.c @@ -24,6 +24,7 @@  #define PRCM_MOD_EN		0x2  #define PRCM_FORCE_WAKEUP	0x2 +#define PRCM_FUNCTL		0x0  #define PRCM_EMIF_CLK_ACTIVITY	BIT(2)  #define PRCM_L3_GCLK_ACTIVITY	BIT(4) @@ -38,7 +39,7 @@  #define CLK_MODE_SEL		0x7  #define CLK_MODE_MASK		0xfffffff8  #define CLK_DIV_SEL		0xFFFFFFE0 - +#define CPGMAC0_IDLE		0x30000  const struct cm_perpll *cmper = (struct cm_perpll *)CM_PER;  const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP; @@ -70,6 +71,10 @@ static void enable_interface_clocks(void)  	writel(PRCM_MOD_EN, &cmper->l4hsclkctrl);  	while (readl(&cmper->l4hsclkctrl) != PRCM_MOD_EN)  		; + +	writel(PRCM_MOD_EN, &cmwkup->wkgpio0clkctrl); +	while (readl(&cmwkup->wkgpio0clkctrl) != PRCM_MOD_EN) +		;  }  /* @@ -118,6 +123,36 @@ static void enable_per_clocks(void)  	writel(PRCM_MOD_EN, &cmwkup->wkup_i2c0ctrl);  	while (readl(&cmwkup->wkup_i2c0ctrl) != PRCM_MOD_EN)  		; + +	/* gpio1 module */ +	writel(PRCM_MOD_EN, &cmper->gpio1clkctrl); +	while (readl(&cmper->gpio1clkctrl) != PRCM_MOD_EN) +		; + +	/* gpio2 module */ +	writel(PRCM_MOD_EN, &cmper->gpio2clkctrl); +	while (readl(&cmper->gpio2clkctrl) != PRCM_MOD_EN) +		; + +	/* gpio3 module */ +	writel(PRCM_MOD_EN, &cmper->gpio3clkctrl); +	while (readl(&cmper->gpio3clkctrl) != PRCM_MOD_EN) +		; + +	/* i2c1 */ +	writel(PRCM_MOD_EN, &cmper->i2c1clkctrl); +	while (readl(&cmper->i2c1clkctrl) != PRCM_MOD_EN) +		; + +	/* Ethernet */ +	writel(PRCM_MOD_EN, &cmper->cpgmac0clkctrl); +	while ((readl(&cmper->cpgmac0clkctrl) & CPGMAC0_IDLE) != PRCM_FUNCTL) +		; + +	/* spi0 */ +	writel(PRCM_MOD_EN, &cmper->spi0clkctrl); +	while (readl(&cmper->spi0clkctrl) != PRCM_MOD_EN) +		;  }  static void mpu_pll_config(void) @@ -216,7 +251,7 @@ static void per_pll_config(void)  		;  } -static void ddr_pll_config(void) +void ddr_pll_config(unsigned int ddrpll_m)  {  	u32 clkmode, clksel, div_m2; @@ -234,7 +269,7 @@ static void ddr_pll_config(void)  		;  	clksel = clksel & (~CLK_SEL_MASK); -	clksel = clksel | ((DDRPLL_M << CLK_SEL_SHIFT) | DDRPLL_N); +	clksel = clksel | ((ddrpll_m << CLK_SEL_SHIFT) | DDRPLL_N);  	writel(clksel, &cmwkup->clkseldpllddr);  	div_m2 = div_m2 & CLK_DIV_SEL; @@ -255,11 +290,6 @@ void enable_emif_clocks(void)  	writel(PRCM_MOD_EN, &cmper->emiffwclkctrl);  	/* Enable EMIF0 Clock */  	writel(PRCM_MOD_EN, &cmper->emifclkctrl); -	/* Poll for emif_gclk  & L3_G clock  are active */ -	while ((readl(&cmper->l3clkstctrl) & (PRCM_EMIF_CLK_ACTIVITY | -			PRCM_L3_GCLK_ACTIVITY)) != (PRCM_EMIF_CLK_ACTIVITY | -			PRCM_L3_GCLK_ACTIVITY)) -		;  	/* Poll if module is functional */  	while ((readl(&cmper->emifclkctrl)) != PRCM_MOD_EN)  		; @@ -273,7 +303,6 @@ void pll_init()  	mpu_pll_config();  	core_pll_config();  	per_pll_config(); -	ddr_pll_config();  	/* Enable the required interconnect clocks */  	enable_interface_clocks(); diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c index ed982c11e..fd9fc4a72 100644 --- a/arch/arm/cpu/armv7/am33xx/ddr.c +++ b/arch/arm/cpu/armv7/am33xx/ddr.c @@ -17,13 +17,15 @@ http://www.ti.com/  #include <asm/arch/cpu.h>  #include <asm/arch/ddr_defs.h> +#include <asm/arch/sys_proto.h>  #include <asm/io.h> +#include <asm/emif.h>  /**   * Base address for EMIF instances   */ -static struct emif_regs *emif_reg = { -				(struct emif_regs *)EMIF4_0_CFG_BASE}; +static struct emif_reg_struct *emif_reg = { +				(struct emif_reg_struct *)EMIF4_0_CFG_BASE};  /**   * Base address for DDR instance @@ -39,109 +41,79 @@ static struct ddr_cmdtctrl *ioctrl_reg = {  			(struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};  /** - * As a convention, all functions here return 0 on success - * -1 on failure. - */ - -/**   * Configure SDRAM   */ -int config_sdram(struct sdram_config *cfg) +void config_sdram(const struct emif_regs *regs)  { -	writel(cfg->sdrcr, &emif_reg->sdrcr); -	writel(cfg->sdrcr2, &emif_reg->sdrcr2); -	writel(cfg->refresh, &emif_reg->sdrrcr); -	writel(cfg->refresh_sh, &emif_reg->sdrrcsr); - -	return 0; +	writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl); +	writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl_shdw); +	if (regs->zq_config){ +		writel(regs->zq_config, &emif_reg->emif_zq_config); +		writel(regs->sdram_config, &cstat->secure_emif_sdram_config); +	} +	writel(regs->sdram_config, &emif_reg->emif_sdram_config);  }  /**   * Set SDRAM timings   */ -int set_sdram_timings(struct sdram_timing *t) +void set_sdram_timings(const struct emif_regs *regs)  { -	writel(t->time1, &emif_reg->sdrtim1); -	writel(t->time1_sh, &emif_reg->sdrtim1sr); -	writel(t->time2, &emif_reg->sdrtim2); -	writel(t->time2_sh, &emif_reg->sdrtim2sr); -	writel(t->time3, &emif_reg->sdrtim3); -	writel(t->time3_sh, &emif_reg->sdrtim3sr); - -	return 0; +	writel(regs->sdram_tim1, &emif_reg->emif_sdram_tim_1); +	writel(regs->sdram_tim1, &emif_reg->emif_sdram_tim_1_shdw); +	writel(regs->sdram_tim2, &emif_reg->emif_sdram_tim_2); +	writel(regs->sdram_tim2, &emif_reg->emif_sdram_tim_2_shdw); +	writel(regs->sdram_tim3, &emif_reg->emif_sdram_tim_3); +	writel(regs->sdram_tim3, &emif_reg->emif_sdram_tim_3_shdw);  }  /**   * Configure DDR PHY   */ -int config_ddr_phy(struct ddr_phy_control *p) +void config_ddr_phy(const struct emif_regs *regs)  { -	writel(p->reg, &emif_reg->ddrphycr); -	writel(p->reg_sh, &emif_reg->ddrphycsr); - -	return 0; +	writel(regs->emif_ddr_phy_ctlr_1, &emif_reg->emif_ddr_phy_ctrl_1); +	writel(regs->emif_ddr_phy_ctlr_1, &emif_reg->emif_ddr_phy_ctrl_1_shdw);  }  /**   * Configure DDR CMD control registers   */ -int config_cmd_ctrl(struct cmd_control *cmd) +void config_cmd_ctrl(const struct cmd_control *cmd)  {  	writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio); -	writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce); -	writel(cmd->cmd0csdelay, &ddr_reg[0]->cm0csdelay);  	writel(cmd->cmd0dldiff, &ddr_reg[0]->cm0dldiff);  	writel(cmd->cmd0iclkout, &ddr_reg[0]->cm0iclkout);  	writel(cmd->cmd1csratio, &ddr_reg[0]->cm1csratio); -	writel(cmd->cmd1csforce, &ddr_reg[0]->cm1csforce); -	writel(cmd->cmd1csdelay, &ddr_reg[0]->cm1csdelay);  	writel(cmd->cmd1dldiff, &ddr_reg[0]->cm1dldiff);  	writel(cmd->cmd1iclkout, &ddr_reg[0]->cm1iclkout);  	writel(cmd->cmd2csratio, &ddr_reg[0]->cm2csratio); -	writel(cmd->cmd2csforce, &ddr_reg[0]->cm2csforce); -	writel(cmd->cmd2csdelay, &ddr_reg[0]->cm2csdelay);  	writel(cmd->cmd2dldiff, &ddr_reg[0]->cm2dldiff);  	writel(cmd->cmd2iclkout, &ddr_reg[0]->cm2iclkout); - -	return 0;  }  /**   * Configure DDR DATA registers   */ -int config_ddr_data(int macrono, struct ddr_data *data) +void config_ddr_data(int macrono, const struct ddr_data *data)  {  	writel(data->datardsratio0, &ddr_reg[macrono]->dt0rdsratio0); -	writel(data->datardsratio1, &ddr_reg[macrono]->dt0rdsratio1); -  	writel(data->datawdsratio0, &ddr_reg[macrono]->dt0wdsratio0); -	writel(data->datawdsratio1, &ddr_reg[macrono]->dt0wdsratio1); -  	writel(data->datawiratio0, &ddr_reg[macrono]->dt0wiratio0); -	writel(data->datawiratio1, &ddr_reg[macrono]->dt0wiratio1);  	writel(data->datagiratio0, &ddr_reg[macrono]->dt0giratio0); -	writel(data->datagiratio1, &ddr_reg[macrono]->dt0giratio1); -  	writel(data->datafwsratio0, &ddr_reg[macrono]->dt0fwsratio0); -	writel(data->datafwsratio1, &ddr_reg[macrono]->dt0fwsratio1); -  	writel(data->datawrsratio0, &ddr_reg[macrono]->dt0wrsratio0); -	writel(data->datawrsratio1, &ddr_reg[macrono]->dt0wrsratio1); - +	writel(data->datauserank0delay, &ddr_reg[macrono]->dt0rdelays0);  	writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0); - -	return 0;  } -int config_io_ctrl(struct ddr_ioctrl *ioctrl) +void config_io_ctrl(unsigned long val)  { -	writel(ioctrl->cmd1ctl, &ioctrl_reg->cm0ioctl); -	writel(ioctrl->cmd2ctl, &ioctrl_reg->cm1ioctl); -	writel(ioctrl->cmd3ctl, &ioctrl_reg->cm2ioctl); -	writel(ioctrl->data1ctl, &ioctrl_reg->dt0ioctl); -	writel(ioctrl->data2ctl, &ioctrl_reg->dt1ioctl); - -	return 0; +	writel(val, &ioctrl_reg->cm0ioctl); +	writel(val, &ioctrl_reg->cm1ioctl); +	writel(val, &ioctrl_reg->cm2ioctl); +	writel(val, &ioctrl_reg->dt0ioctl); +	writel(val, &ioctrl_reg->dt1ioctl);  } diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c b/arch/arm/cpu/armv7/am33xx/emif4.c index 2f4164df8..b2d7c0d95 100644 --- a/arch/arm/cpu/armv7/am33xx/emif4.c +++ b/arch/arm/cpu/armv7/am33xx/emif4.c @@ -21,15 +21,12 @@  #include <asm/arch/ddr_defs.h>  #include <asm/arch/hardware.h>  #include <asm/arch/clock.h> +#include <asm/arch/sys_proto.h>  #include <asm/io.h> +#include <asm/emif.h>  DECLARE_GLOBAL_DATA_PTR; -struct ddr_regs *ddrregs = (struct ddr_regs *)DDR_PHY_BASE_ADDR; -struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR; -struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR; - -  int dram_init(void)  {  	/* dram_init must store complete ramsize in gd->ram_size */ @@ -47,58 +44,80 @@ void dram_init_banksize(void)  #ifdef CONFIG_SPL_BUILD -static void data_macro_config(int dataMacroNum) -{ -	struct ddr_data data; +static struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR; +static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR; -	data.datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20) -				|(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0)); -	data.datardsratio1 = DDR2_RD_DQS>>2; -	data.datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20) -				|(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0)); -	data.datawdsratio1 = DDR2_WR_DQS>>2; -	data.datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20) -				|(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0)); -	data.datawiratio1 = DDR2_PHY_WRLVL>>2; -	data.datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20) -				|(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0)); -	data.datagiratio1 = DDR2_PHY_GATELVL>>2; -	data.datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20) -				|(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0)); -	data.datafwsratio1 = DDR2_PHY_FIFO_WE>>2; -	data.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20) -				|(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0)); -	data.datawrsratio1 = DDR2_PHY_WR_DATA>>2; -	data.datadldiff0 = PHY_DLL_LOCK_DIFF; +static const struct ddr_data ddr2_data = { +	.datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20) +				|(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0)), +	.datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20) +				|(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0)), +	.datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20) +				|(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0)), +	.datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20) +				|(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0)), +	.datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20) +				|(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0)), +	.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20) +				|(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0)), +	.datauserank0delay = DDR2_PHY_RANK0_DELAY, +	.datadldiff0 = PHY_DLL_LOCK_DIFF, +}; -	config_ddr_data(dataMacroNum, &data); -} +static const struct cmd_control ddr2_cmd_ctrl_data = { +	.cmd0csratio = DDR2_RATIO, +	.cmd0dldiff = DDR2_DLL_LOCK_DIFF, +	.cmd0iclkout = DDR2_INVERT_CLKOUT, -static void cmd_macro_config(void) -{ -	struct cmd_control cmd; +	.cmd1csratio = DDR2_RATIO, +	.cmd1dldiff = DDR2_DLL_LOCK_DIFF, +	.cmd1iclkout = DDR2_INVERT_CLKOUT, -	cmd.cmd0csratio = DDR2_RATIO; -	cmd.cmd0csforce = CMD_FORCE; -	cmd.cmd0csdelay = CMD_DELAY; -	cmd.cmd0dldiff = DDR2_DLL_LOCK_DIFF; -	cmd.cmd0iclkout = DDR2_INVERT_CLKOUT; +	.cmd2csratio = DDR2_RATIO, +	.cmd2dldiff = DDR2_DLL_LOCK_DIFF, +	.cmd2iclkout = DDR2_INVERT_CLKOUT, +}; -	cmd.cmd1csratio = DDR2_RATIO; -	cmd.cmd1csforce = CMD_FORCE; -	cmd.cmd1csdelay = CMD_DELAY; -	cmd.cmd1dldiff = DDR2_DLL_LOCK_DIFF; -	cmd.cmd1iclkout = DDR2_INVERT_CLKOUT; +static const struct emif_regs ddr2_emif_reg_data = { +	.sdram_config = DDR2_EMIF_SDCFG, +	.ref_ctrl = DDR2_EMIF_SDREF, +	.sdram_tim1 = DDR2_EMIF_TIM1, +	.sdram_tim2 = DDR2_EMIF_TIM2, +	.sdram_tim3 = DDR2_EMIF_TIM3, +	.emif_ddr_phy_ctlr_1 = DDR2_EMIF_READ_LATENCY, +}; -	cmd.cmd2csratio = DDR2_RATIO; -	cmd.cmd2csforce = CMD_FORCE; -	cmd.cmd2csdelay = CMD_DELAY; -	cmd.cmd2dldiff = DDR2_DLL_LOCK_DIFF; -	cmd.cmd2iclkout = DDR2_INVERT_CLKOUT; +static const struct ddr_data ddr3_data = { +	.datardsratio0 = DDR3_RD_DQS, +	.datawdsratio0 = DDR3_WR_DQS, +	.datafwsratio0 = DDR3_PHY_FIFO_WE, +	.datawrsratio0 = DDR3_PHY_WR_DATA, +	.datadldiff0 = PHY_DLL_LOCK_DIFF, +}; -	config_cmd_ctrl(&cmd); +static const struct cmd_control ddr3_cmd_ctrl_data = { +	.cmd0csratio = DDR3_RATIO, +	.cmd0dldiff = DDR3_DLL_LOCK_DIFF, +	.cmd0iclkout = DDR3_INVERT_CLKOUT, -} +	.cmd1csratio = DDR3_RATIO, +	.cmd1dldiff = DDR3_DLL_LOCK_DIFF, +	.cmd1iclkout = DDR3_INVERT_CLKOUT, + +	.cmd2csratio = DDR3_RATIO, +	.cmd2dldiff = DDR3_DLL_LOCK_DIFF, +	.cmd2iclkout = DDR3_INVERT_CLKOUT, +}; + +static struct emif_regs ddr3_emif_reg_data = { +	.sdram_config = DDR3_EMIF_SDCFG, +	.ref_ctrl = DDR3_EMIF_SDREF, +	.sdram_tim1 = DDR3_EMIF_TIM1, +	.sdram_tim2 = DDR3_EMIF_TIM2, +	.sdram_tim3 = DDR3_EMIF_TIM3, +	.zq_config = DDR3_ZQ_CFG, +	.emif_ddr_phy_ctlr_1 = DDR3_EMIF_READ_LATENCY, +};  static void config_vtp(void)  { @@ -115,87 +134,46 @@ static void config_vtp(void)  		;  } -static void config_emif_ddr2(void) +void config_ddr(short ddr_type)  { -	int i; -	int ret; -	struct sdram_config cfg; -	struct sdram_timing tmg; -	struct ddr_phy_control phyc; - -	/*Program EMIF0 CFG Registers*/ -	phyc.reg = EMIF_READ_LATENCY; -	phyc.reg_sh = EMIF_READ_LATENCY; -	phyc.reg2 = EMIF_READ_LATENCY; - -	tmg.time1 = EMIF_TIM1; -	tmg.time1_sh = EMIF_TIM1; -	tmg.time2 = EMIF_TIM2; -	tmg.time2_sh = EMIF_TIM2; -	tmg.time3 = EMIF_TIM3; -	tmg.time3_sh = EMIF_TIM3; - -	cfg.sdrcr = EMIF_SDCFG; -	cfg.sdrcr2 = EMIF_SDCFG; -	cfg.refresh = 0x00004650; -	cfg.refresh_sh = 0x00004650; - -	/* Program EMIF instance */ -	ret = config_ddr_phy(&phyc); -	if (ret < 0) -		printf("Couldn't configure phyc\n"); +	int ddr_pll, ioctrl_val; +	const struct emif_regs *emif_regs; +	const struct ddr_data *ddr_data; +	const struct cmd_control *cmd_ctrl_data; -	ret = config_sdram(&cfg); -	if (ret < 0) -		printf("Couldn't configure SDRAM\n"); - -	ret = set_sdram_timings(&tmg); -	if (ret < 0) -		printf("Couldn't configure timings\n"); - -	/* Delay */ -	for (i = 0; i < 5000; i++) -		; - -	cfg.refresh = EMIF_SDREF; -	cfg.refresh_sh = EMIF_SDREF; -	cfg.sdrcr = EMIF_SDCFG; -	cfg.sdrcr2 = EMIF_SDCFG; - -	ret = config_sdram(&cfg); -	if (ret < 0) -		printf("Couldn't configure SDRAM\n"); -} - -void config_ddr(void) -{ -	int data_macro_0 = 0; -	int data_macro_1 = 1; -	struct ddr_ioctrl ioctrl; +	if (ddr_type == EMIF_REG_SDRAM_TYPE_DDR2) { +		ddr_pll = 266; +		cmd_ctrl_data = &ddr2_cmd_ctrl_data; +		ddr_data = &ddr2_data; +		ioctrl_val = DDR2_IOCTRL_VALUE; +		emif_regs = &ddr2_emif_reg_data; +	} else if (ddr_type == EMIF_REG_SDRAM_TYPE_DDR3) { +		ddr_pll = 303; +		cmd_ctrl_data = &ddr3_cmd_ctrl_data; +		ddr_data = &ddr3_data; +		ioctrl_val = DDR3_IOCTRL_VALUE; +		emif_regs = &ddr3_emif_reg_data; +	} else { +		puts("Unknown memory type"); +		hang(); +	}  	enable_emif_clocks(); - +	ddr_pll_config(ddr_pll);  	config_vtp(); +	config_cmd_ctrl(cmd_ctrl_data); -	cmd_macro_config(); - -	data_macro_config(data_macro_0); -	data_macro_config(data_macro_1); +	config_ddr_data(0, ddr_data); +	config_ddr_data(1, ddr_data); -	writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0); -	writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0); +	config_io_ctrl(ioctrl_val); -	ioctrl.cmd1ctl = DDR_IOCTRL_VALUE; -	ioctrl.cmd2ctl = DDR_IOCTRL_VALUE; -	ioctrl.cmd3ctl = DDR_IOCTRL_VALUE; -	ioctrl.data1ctl = DDR_IOCTRL_VALUE; -	ioctrl.data2ctl = DDR_IOCTRL_VALUE; +	/* Set CKE to be controlled by EMIF/DDR PHY */ +	writel(DDR_CKE_CTRL_NORMAL, &ddrctrl->ddrckectrl); -	config_io_ctrl(&ioctrl); - -	writel(readl(&ddrctrl->ddrioctrl) & 0xefffffff, &ddrctrl->ddrioctrl); -	writel(readl(&ddrctrl->ddrckectrl) | 0x00000001, &ddrctrl->ddrckectrl); - -	config_emif_ddr2(); +	/* Program EMIF instance */ +	config_ddr_phy(emif_regs); +	set_sdram_timings(emif_regs); +	config_sdram(emif_regs);  }  #endif diff --git a/arch/arm/cpu/armv7/config.mk b/arch/arm/cpu/armv7/config.mk index 560c084dc..5407cb68a 100644 --- a/arch/arm/cpu/armv7/config.mk +++ b/arch/arm/cpu/armv7/config.mk @@ -26,8 +26,6 @@ PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float  # supported by more tool-chains  PF_CPPFLAGS_ARMV7 := $(call cc-option, -march=armv7-a, -march=armv5)  PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARMV7) -PF_CPPFLAGS_NO_UNALIGNED := $(call cc-option, -mno-unaligned-access,) -PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_NO_UNALIGNED)  # =========================================================================  # diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c index c6fa8ef13..39a80237c 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -36,13 +36,9 @@  #include <asm/system.h>  #include <asm/cache.h>  #include <asm/armv7.h> +#include <linux/compiler.h> -void save_boot_params_default(u32 r0, u32 r1, u32 r2, u32 r3) -{ -} - -void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) -	__attribute__((weak, alias("save_boot_params_default"))); +void __weak cpu_cache_initialization(void){}  int cleanup_before_linux(void)  { @@ -81,5 +77,10 @@ int cleanup_before_linux(void)  	 */  	invalidate_dcache_all(); +	/* +	 * Some CPU need more cache attention before starting the kernel. +	 */ +	cpu_cache_initialization(); +  	return 0;  } diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index f7829b2cc..4f3b451be 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -98,7 +98,7 @@ static unsigned long exynos5_get_pll_clk(int pllreg)  	struct exynos5_clock *clk =  		(struct exynos5_clock *)samsung_get_base_clock();  	unsigned long r, m, p, s, k = 0, mask, fout; -	unsigned int freq; +	unsigned int freq, pll_div2_sel, fout_sel;  	switch (pllreg) {  	case APLL: @@ -115,6 +115,9 @@ static unsigned long exynos5_get_pll_clk(int pllreg)  		r = readl(&clk->vpll_con0);  		k = readl(&clk->vpll_con1);  		break; +	case BPLL: +		r = readl(&clk->bpll_con0); +		break;  	default:  		printf("Unsupported PLL (%d)\n", pllreg);  		return 0; @@ -125,8 +128,9 @@ static unsigned long exynos5_get_pll_clk(int pllreg)  	 * MPLL_CON: MIDV [25:16]  	 * EPLL_CON: MIDV [24:16]  	 * VPLL_CON: MIDV [24:16] +	 * BPLL_CON: MIDV [25:16]  	 */ -	if (pllreg == APLL || pllreg == MPLL) +	if (pllreg == APLL || pllreg == MPLL || pllreg == BPLL)  		mask = 0x3ff;  	else  		mask = 0x1ff; @@ -155,6 +159,29 @@ static unsigned long exynos5_get_pll_clk(int pllreg)  		fout = m * (freq / (p * (1 << (s - 1))));  	} +	/* According to the user manual, in EVT1 MPLL and BPLL always gives +	 * 1.6GHz clock, so divide by 2 to get 800MHz MPLL clock.*/ +	if (pllreg == MPLL || pllreg == BPLL) { +		pll_div2_sel = readl(&clk->pll_div2_sel); + +		switch (pllreg) { +		case MPLL: +			fout_sel = (pll_div2_sel >> MPLL_FOUT_SEL_SHIFT) +					& MPLL_FOUT_SEL_MASK; +			break; +		case BPLL: +			fout_sel = (pll_div2_sel >> BPLL_FOUT_SEL_SHIFT) +					& BPLL_FOUT_SEL_MASK; +			break; +		default: +			fout_sel = -1; +			break; +		} + +		if (fout_sel == 0) +			fout /= 2; +	} +  	return fout;  } @@ -456,6 +483,48 @@ static unsigned long exynos4_get_lcd_clk(void)  	return pclk;  } +/* get_lcd_clk: return lcd clock frequency */ +static unsigned long exynos5_get_lcd_clk(void) +{ +	struct exynos5_clock *clk = +		(struct exynos5_clock *)samsung_get_base_clock(); +	unsigned long pclk, sclk; +	unsigned int sel; +	unsigned int ratio; + +	/* +	 * CLK_SRC_LCD0 +	 * FIMD0_SEL [3:0] +	 */ +	sel = readl(&clk->src_disp1_0); +	sel = sel & 0xf; + +	/* +	 * 0x6: SCLK_MPLL +	 * 0x7: SCLK_EPLL +	 * 0x8: SCLK_VPLL +	 */ +	if (sel == 0x6) +		sclk = get_pll_clk(MPLL); +	else if (sel == 0x7) +		sclk = get_pll_clk(EPLL); +	else if (sel == 0x8) +		sclk = get_pll_clk(VPLL); +	else +		return 0; + +	/* +	 * CLK_DIV_LCD0 +	 * FIMD0_RATIO [3:0] +	 */ +	ratio = readl(&clk->div_disp1_0); +	ratio = ratio & 0xf; + +	pclk = sclk / (ratio + 1); + +	return pclk; +} +  void exynos4_set_lcd_clk(void)  {  	struct exynos4_clock *clk = @@ -518,6 +587,68 @@ void exynos4_set_lcd_clk(void)  	writel(cfg, &clk->div_lcd0);  } +void exynos5_set_lcd_clk(void) +{ +	struct exynos5_clock *clk = +	    (struct exynos5_clock *)samsung_get_base_clock(); +	unsigned int cfg = 0; + +	/* +	 * CLK_GATE_BLOCK +	 * CLK_CAM	[0] +	 * CLK_TV	[1] +	 * CLK_MFC	[2] +	 * CLK_G3D	[3] +	 * CLK_LCD0	[4] +	 * CLK_LCD1	[5] +	 * CLK_GPS	[7] +	 */ +	cfg = readl(&clk->gate_block); +	cfg |= 1 << 4; +	writel(cfg, &clk->gate_block); + +	/* +	 * CLK_SRC_LCD0 +	 * FIMD0_SEL		[3:0] +	 * MDNIE0_SEL		[7:4] +	 * MDNIE_PWM0_SEL	[8:11] +	 * MIPI0_SEL		[12:15] +	 * set lcd0 src clock 0x6: SCLK_MPLL +	 */ +	cfg = readl(&clk->src_disp1_0); +	cfg &= ~(0xf); +	cfg |= 0x8; +	writel(cfg, &clk->src_disp1_0); + +	/* +	 * CLK_GATE_IP_LCD0 +	 * CLK_FIMD0		[0] +	 * CLK_MIE0		[1] +	 * CLK_MDNIE0		[2] +	 * CLK_DSIM0		[3] +	 * CLK_SMMUFIMD0	[4] +	 * CLK_PPMULCD0		[5] +	 * Gating all clocks for FIMD0 +	 */ +	cfg = readl(&clk->gate_ip_disp1); +	cfg |= 1 << 0; +	writel(cfg, &clk->gate_ip_disp1); + +	/* +	 * CLK_DIV_LCD0 +	 * FIMD0_RATIO		[3:0] +	 * MDNIE0_RATIO		[7:4] +	 * MDNIE_PWM0_RATIO	[11:8] +	 * MDNIE_PWM_PRE_RATIO	[15:12] +	 * MIPI0_RATIO		[19:16] +	 * MIPI0_PRE_RATIO	[23:20] +	 * set fimd ratio +	 */ +	cfg &= ~(0xf); +	cfg |= 0x0; +	writel(cfg, &clk->div_disp1_0); +} +  void exynos4_set_mipi_clk(void)  {  	struct exynos4_clock *clk = @@ -656,13 +787,15 @@ unsigned long get_lcd_clk(void)  	if (cpu_is_exynos4())  		return exynos4_get_lcd_clk();  	else -		return 0; +		return exynos5_get_lcd_clk();  }  void set_lcd_clk(void)  {  	if (cpu_is_exynos4())  		exynos4_set_lcd_clk(); +	else +		exynos5_set_lcd_clk();  }  void set_mipi_clk(void) diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index d28f05557..7776add9d 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -40,8 +40,8 @@ static void exynos5_uart_config(int peripheral)  		count = 4;  		break;  	case PERIPH_ID_UART1: -		bank = &gpio1->a0; -		start = 4; +		bank = &gpio1->d0; +		start = 0;  		count = 4;  		break;  	case PERIPH_ID_UART2: @@ -66,23 +66,27 @@ static int exynos5_mmc_config(int peripheral, int flags)  	struct exynos5_gpio_part1 *gpio1 =  		(struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();  	struct s5p_gpio_bank *bank, *bank_ext; -	int i; +	int i, start = 0, gpio_func = 0;  	switch (peripheral) {  	case PERIPH_ID_SDMMC0:  		bank = &gpio1->c0;  		bank_ext = &gpio1->c1; +		start = 0; +		gpio_func = GPIO_FUNC(0x2);  		break;  	case PERIPH_ID_SDMMC1: -		bank = &gpio1->c1; +		bank = &gpio1->c2;  		bank_ext = NULL;  		break;  	case PERIPH_ID_SDMMC2: -		bank = &gpio1->c2; -		bank_ext = &gpio1->c3; +		bank = &gpio1->c3; +		bank_ext = &gpio1->c4; +		start = 3; +		gpio_func = GPIO_FUNC(0x3);  		break;  	case PERIPH_ID_SDMMC3: -		bank = &gpio1->c3; +		bank = &gpio1->c4;  		bank_ext = NULL;  		break;  	} @@ -92,8 +96,8 @@ static int exynos5_mmc_config(int peripheral, int flags)  		return -1;  	}  	if (flags & PINMUX_FLAG_8BIT_MODE) { -		for (i = 3; i <= 6; i++) { -			s5p_gpio_cfg_pin(bank_ext, i, GPIO_FUNC(0x3)); +		for (i = start; i <= (start + 3); i++) { +			s5p_gpio_cfg_pin(bank_ext, i, gpio_func);  			s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_UP);  			s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);  		} diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c index 4116781a3..d4bce6d4d 100644 --- a/arch/arm/cpu/armv7/exynos/power.c +++ b/arch/arm/cpu/armv7/exynos/power.c @@ -74,3 +74,24 @@ void set_usbhost_phy_ctrl(unsigned int enable)  	if (cpu_is_exynos5())  		exynos5_set_usbhost_phy_ctrl(enable);  } + +static void exynos5_dp_phy_control(unsigned int enable) +{ +	unsigned int cfg; +	struct exynos5_power *power = +	    (struct exynos5_power *)samsung_get_base_power(); + +	cfg = readl(&power->dptx_phy_control); +	if (enable) +		cfg |= EXYNOS_DP_PHY_ENABLE; +	else +		cfg &= ~EXYNOS_DP_PHY_ENABLE; + +	writel(cfg, &power->dptx_phy_control); +} + +void set_dp_phy_ctrl(unsigned int enable) +{ +	if (cpu_is_exynos5()) +		exynos5_dp_phy_control(enable); +} diff --git a/arch/arm/cpu/armv7/exynos/soc.c b/arch/arm/cpu/armv7/exynos/soc.c index dcfcec22d..ab65b8d3a 100644 --- a/arch/arm/cpu/armv7/exynos/soc.c +++ b/arch/arm/cpu/armv7/exynos/soc.c @@ -28,3 +28,11 @@ void reset_cpu(ulong addr)  {  	writel(0x1, samsung_get_base_swreset());  } + +#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/exynos/system.c b/arch/arm/cpu/armv7/exynos/system.c index 4426611d1..8424c57e9 100644 --- a/arch/arm/cpu/armv7/exynos/system.c +++ b/arch/arm/cpu/armv7/exynos/system.c @@ -62,8 +62,26 @@ static void exynos4_set_system_display(void)  	writel(cfg, &sysreg->display_ctrl);  } +static void exynos5_set_system_display(void) +{ +	struct exynos5_sysreg *sysreg = +	    (struct exynos5_sysreg *)samsung_get_base_sysreg(); +	unsigned int cfg = 0; + +	/* +	 * system register path set +	 * 0: MIE/MDNIE +	 * 1: FIMD Bypass +	 */ +	cfg = readl(&sysreg->disp1blk_cfg); +	cfg |= (1 << 15); +	writel(cfg, &sysreg->disp1blk_cfg); +} +  void set_system_display_ctrl(void)  {  	if (cpu_is_exynos4())  		exynos4_set_system_display(); +	else +		exynos5_set_system_display();  } diff --git a/arch/arm/cpu/armv7/highbank/Makefile b/arch/arm/cpu/armv7/highbank/Makefile index 917c3a36b..76faeb0fe 100644 --- a/arch/arm/cpu/armv7/highbank/Makefile +++ b/arch/arm/cpu/armv7/highbank/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o -COBJS	:= timer.o bootcount.o +COBJS	:= timer.o  SOBJS	:=  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/cpu/armv7/highbank/bootcount.c b/arch/arm/cpu/armv7/highbank/bootcount.c deleted file mode 100644 index 9ca06567a..000000000 --- a/arch/arm/cpu/armv7/highbank/bootcount.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2011 Calxeda, Inc. - * - * 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 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/>. - */ - -#include <common.h> -#include <asm/io.h> - -#ifdef CONFIG_BOOTCOUNT_LIMIT -void bootcount_store(ulong a) -{ -	writel((BOOTCOUNT_MAGIC & 0xffff0000) | a, CONFIG_SYS_BOOTCOUNT_ADDR); -} - -ulong bootcount_load(void) -{ -	u32 tmp = readl(CONFIG_SYS_BOOTCOUNT_ADDR); - -	if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000)) -		return 0; -	else -		return tmp & 0x0000ffff; -} -#endif diff --git a/arch/arm/cpu/armv7/lowlevel_init.S b/arch/arm/cpu/armv7/lowlevel_init.S new file mode 100644 index 000000000..0d45528e9 --- /dev/null +++ b/arch/arm/cpu/armv7/lowlevel_init.S @@ -0,0 +1,51 @@ +/* + * A lowlevel_init function that sets up the stack to call a C function to + * perform further init. + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * + * Author : + *	Aneesh V	<aneesh@ti.com> + * + * 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 <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) +	/* +	 * Setup a temporary stack +	 */ +	ldr	sp, =CONFIG_SYS_INIT_SP_ADDR +	bic	sp, sp, #7 /* 8-byte alignment for ABI compliance */ + +	/* +	 * Save the old lr(passed in ip) and the current lr to stack +	 */ +	push	{ip, lr} + +	/* +	 * go setup pll, mux, memory +	 */ +	bl	s_init +	pop	{ip, pc} +ENDPROC(lowlevel_init) diff --git a/arch/arm/cpu/armv7/mx5/lowlevel_init.S b/arch/arm/cpu/armv7/mx5/lowlevel_init.S index 683a7b53a..a40b84fee 100644 --- a/arch/arm/cpu/armv7/mx5/lowlevel_init.S +++ b/arch/arm/cpu/armv7/mx5/lowlevel_init.S @@ -36,9 +36,9 @@  	/* reconfigure L2 cache aux control reg */  	mov r0, #0xC0			/* tag RAM */  	add r0, r0, #0x4		/* data RAM */ -	orr r0, r0, #(1 << 24)		/* disable write allocate delay */ -	orr r0, r0, #(1 << 23)		/* disable write allocate combine */ -	orr r0, r0, #(1 << 22)		/* disable write allocate */ +	orr r0, r0, #1 << 24		/* disable write allocate delay */ +	orr r0, r0, #1 << 23		/* disable write allocate combine */ +	orr r0, r0, #1 << 22		/* disable write allocate */  #if defined(CONFIG_MX51)  	ldr r1, =0x0 @@ -46,7 +46,7 @@  	cmp r3, #0x10  	/* disable write combine for TO 2 and lower revs */ -	orrls r0, r0, #(1 << 25) +	orrls r0, r0, #1 << 25  #endif  	mcr 15, 1, r0, c9, c0, 2 @@ -247,9 +247,9 @@  	movhi r1, #0  #else  	mov r1, #0 -  #endif  	str r1, [r0, #CLKCTL_CACRR] +  	/* Switch ARM back to PLL 1 */  	mov r1, #0  	str r1, [r0, #CLKCTL_CCSR] @@ -288,9 +288,9 @@  	/* Switch peripheral to PLL2 */  	ldr r0, =CCM_BASE_ADDR  	ldr r1, =0x00808145 -	orr r1, r1, #(2 << 10) -	orr r1, r1, #(0 << 16) -	orr r1, r1, #(1 << 19) +	orr r1, r1, #2 << 10 +	orr r1, r1, #0 << 16 +	orr r1, r1, #1 << 19  	str r1, [r0, #CLKCTL_CBCDR]  	ldr r1, =0x00016154 @@ -331,10 +331,10 @@ ENTRY(lowlevel_init)  #if defined(CONFIG_MX51)  	ldr r0, =GPIO1_BASE_ADDR  	ldr r1, [r0, #0x0] -	orr r1, r1, #(1 << 23) +	orr r1, r1, #1 << 23  	str r1, [r0, #0x0]  	ldr r1, [r0, #0x4] -	orr r1, r1, #(1 << 23) +	orr r1, r1, #1 << 23  	str r1, [r0, #0x4]  #endif @@ -351,16 +351,16 @@ ENTRY(lowlevel_init)  ENDPROC(lowlevel_init)  /* Board level setting value */ -W_DP_OP_864:              .word DP_OP_864 -W_DP_MFD_864:             .word DP_MFD_864 -W_DP_MFN_864:             .word DP_MFN_864 -W_DP_MFN_800_DIT:         .word DP_MFN_800_DIT -W_DP_OP_800:              .word DP_OP_800 -W_DP_MFD_800:             .word DP_MFD_800 -W_DP_MFN_800:             .word DP_MFN_800 -W_DP_OP_665:              .word DP_OP_665 -W_DP_MFD_665:             .word DP_MFD_665 -W_DP_MFN_665:             .word DP_MFN_665 -W_DP_OP_216:              .word DP_OP_216 -W_DP_MFD_216:             .word DP_MFD_216 -W_DP_MFN_216:             .word DP_MFN_216 +W_DP_OP_864:		.word DP_OP_864 +W_DP_MFD_864:		.word DP_MFD_864 +W_DP_MFN_864:		.word DP_MFN_864 +W_DP_MFN_800_DIT:	.word DP_MFN_800_DIT +W_DP_OP_800:		.word DP_OP_800 +W_DP_MFD_800:		.word DP_MFD_800 +W_DP_MFN_800:		.word DP_MFN_800 +W_DP_OP_665:		.word DP_OP_665 +W_DP_MFD_665:		.word DP_MFD_665 +W_DP_MFN_665:		.word DP_MFN_665 +W_DP_OP_216:		.word DP_OP_216 +W_DP_MFD_216:		.word DP_MFD_216 +W_DP_MFN_216:		.word DP_MFN_216 diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c index 3f5a4f726..263658aa4 100644 --- a/arch/arm/cpu/armv7/mx5/soc.c +++ b/arch/arm/cpu/armv7/mx5/soc.c @@ -30,6 +30,7 @@  #include <asm/errno.h>  #include <asm/io.h> +#include <asm/imx-common/boot_mode.h>  #if !(defined(CONFIG_MX51) || defined(CONFIG_MX53))  #error "CPU_TYPE not defined" @@ -71,6 +72,14 @@ u32 get_cpu_rev(void)  	return system_rev;  } +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches(void) +{ +	/* Enable D-cache. I-cache is already enabled in start.S */ +	dcache_enable(); +} +#endif +  #if defined(CONFIG_FEC_MXC)  void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)  { @@ -115,3 +124,33 @@ void set_chipselect_size(int const cs_size)  	writel(reg, &iomuxc_regs->gpr1);  } + +#ifdef CONFIG_MX53 +void boot_mode_apply(unsigned cfg_val) +{ +	writel(cfg_val, &((struct srtc_regs *)SRTC_BASE_ADDR)->lpgr); +} +/* + * cfg_val will be used for + * Boot_cfg3[7:0]:Boot_cfg2[7:0]:Boot_cfg1[7:0] + * + * If bit 28 of LPGR is set upon watchdog reset, + * bits[25:0] of LPGR will move to SBMR. + */ +const struct boot_mode soc_boot_modes[] = { +	{"normal",	MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)}, +	/* usb or serial download */ +	{"usb",		MAKE_CFGVAL(0x00, 0x00, 0x00, 0x13)}, +	{"sata",	MAKE_CFGVAL(0x28, 0x00, 0x00, 0x12)}, +	{"escpi1:0",	MAKE_CFGVAL(0x38, 0x20, 0x00, 0x12)}, +	{"escpi1:1",	MAKE_CFGVAL(0x38, 0x20, 0x04, 0x12)}, +	{"escpi1:2",	MAKE_CFGVAL(0x38, 0x20, 0x08, 0x12)}, +	{"escpi1:3",	MAKE_CFGVAL(0x38, 0x20, 0x0c, 0x12)}, +	/* 4 bit bus width */ +	{"esdhc1",	MAKE_CFGVAL(0x40, 0x20, 0x00, 0x12)}, +	{"esdhc2",	MAKE_CFGVAL(0x40, 0x20, 0x08, 0x12)}, +	{"esdhc3",	MAKE_CFGVAL(0x40, 0x20, 0x10, 0x12)}, +	{"esdhc4",	MAKE_CFGVAL(0x40, 0x20, 0x18, 0x12)}, +	{NULL,		0}, +}; +#endif diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 84b458c7e..7380ffe46 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -29,6 +29,7 @@  #include <asm/arch/imx-regs.h>  #include <asm/arch/clock.h>  #include <asm/arch/sys_proto.h> +#include <asm/imx-common/boot_mode.h>  u32 get_cpu_rev(void)  { @@ -141,3 +142,38 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)  }  #endif + +void boot_mode_apply(unsigned cfg_val) +{ +	unsigned reg; +	struct src_regs *psrc = (struct src_regs *)SRC_BASE_ADDR; +	writel(cfg_val, &psrc->gpr9); +	reg = readl(&psrc->gpr10); +	if (cfg_val) +		reg |= 1 << 28; +	else +		reg &= ~(1 << 28); +	writel(reg, &psrc->gpr10); +} +/* + * cfg_val will be used for + * Boot_cfg4[7:0]:Boot_cfg3[7:0]:Boot_cfg2[7:0]:Boot_cfg1[7:0] + * After reset, if GPR10[28] is 1, ROM will copy GPR9[25:0] + * to SBMR1, which will determine the boot device. + */ +const struct boot_mode soc_boot_modes[] = { +	{"normal",	MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)}, +	/* reserved value should start rom usb */ +	{"usb",		MAKE_CFGVAL(0x01, 0x00, 0x00, 0x00)}, +	{"sata",	MAKE_CFGVAL(0x20, 0x00, 0x00, 0x00)}, +	{"escpi1:0",	MAKE_CFGVAL(0x30, 0x00, 0x00, 0x08)}, +	{"escpi1:1",	MAKE_CFGVAL(0x30, 0x00, 0x00, 0x18)}, +	{"escpi1:2",	MAKE_CFGVAL(0x30, 0x00, 0x00, 0x28)}, +	{"escpi1:3",	MAKE_CFGVAL(0x30, 0x00, 0x00, 0x38)}, +	/* 4 bit bus width */ +	{"esdhc1",	MAKE_CFGVAL(0x40, 0x20, 0x00, 0x00)}, +	{"esdhc2",	MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)}, +	{"esdhc3",	MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)}, +	{"esdhc4",	MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)}, +	{NULL,		0}, +}; diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile index 2a6625f1c..d37b22d98 100644 --- a/arch/arm/cpu/armv7/omap-common/Makefile +++ b/arch/arm/cpu/armv7/omap-common/Makefile @@ -29,9 +29,6 @@ SOBJS	:= reset.o  COBJS	:= timer.o  COBJS	+= utils.o -ifdef CONFIG_OMAP -COBJS	+= gpio.o -endif  ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)  COBJS	+= hwinit-common.o diff --git a/arch/arm/cpu/armv7/omap-common/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c deleted file mode 100644 index fc89f2a42..000000000 --- a/arch/arm/cpu/armv7/omap-common/gpio.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2009 Wind River Systems, Inc. - * Tom Rix <Tom.Rix@windriver.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 - * - * This work is derived from the linux 2.6.27 kernel source - * To fetch, use the kernel repository - * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git - * Use the v2.6.27 tag. - * - * Below is the original's header including its copyright - * - *  linux/arch/arm/plat-omap/gpio.c - * - * Support functions for OMAP GPIO - * - * Copyright (C) 2003-2005 Nokia Corporation - * Written by Juha Yrjölä <juha.yrjola@nokia.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <common.h> -#include <asm/gpio.h> -#include <asm/io.h> -#include <asm/errno.h> - -#define OMAP_GPIO_DIR_OUT	0 -#define OMAP_GPIO_DIR_IN	1 - -static inline const struct gpio_bank *get_gpio_bank(int gpio) -{ -	return &omap_gpio_bank[gpio >> 5]; -} - -static inline int get_gpio_index(int gpio) -{ -	return gpio & 0x1f; -} - -static inline int gpio_valid(int gpio) -{ -	if (gpio < 0) -		return -1; -	if (gpio < 192) -		return 0; -	return -1; -} - -static int check_gpio(int gpio) -{ -	if (gpio_valid(gpio) < 0) { -		printf("ERROR : check_gpio: invalid GPIO %d\n", gpio); -		return -1; -	} -	return 0; -} - -static void _set_gpio_direction(const struct gpio_bank *bank, int gpio, -				int is_input) -{ -	void *reg = bank->base; -	u32 l; - -	switch (bank->method) { -	case METHOD_GPIO_24XX: -		reg += OMAP_GPIO_OE; -		break; -	default: -		return; -	} -	l = __raw_readl(reg); -	if (is_input) -		l |= 1 << gpio; -	else -		l &= ~(1 << gpio); -	__raw_writel(l, reg); -} - -/** - * Get the direction of the GPIO by reading the GPIO_OE register - * corresponding to the specified bank. - */ -static int _get_gpio_direction(const struct gpio_bank *bank, int gpio) -{ -	void *reg = bank->base; -	u32 v; - -	switch (bank->method) { -	case METHOD_GPIO_24XX: -		reg += OMAP_GPIO_OE; -		break; -	default: -		return -1; -	} - -	v = __raw_readl(reg); - -	if (v & (1 << gpio)) -		return OMAP_GPIO_DIR_IN; -	else -		return OMAP_GPIO_DIR_OUT; -} - -static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio, -				int enable) -{ -	void *reg = bank->base; -	u32 l = 0; - -	switch (bank->method) { -	case METHOD_GPIO_24XX: -		if (enable) -			reg += OMAP_GPIO_SETDATAOUT; -		else -			reg += OMAP_GPIO_CLEARDATAOUT; -		l = 1 << gpio; -		break; -	default: -		printf("omap3-gpio unknown bank method %s %d\n", -		       __FILE__, __LINE__); -		return; -	} -	__raw_writel(l, reg); -} - -/** - * Set value of the specified gpio - */ -int gpio_set_value(unsigned gpio, int value) -{ -	const struct gpio_bank *bank; - -	if (check_gpio(gpio) < 0) -		return -1; -	bank = get_gpio_bank(gpio); -	_set_gpio_dataout(bank, get_gpio_index(gpio), value); - -	return 0; -} - -/** - * Get value of the specified gpio - */ -int gpio_get_value(unsigned gpio) -{ -	const struct gpio_bank *bank; -	void *reg; -	int input; - -	if (check_gpio(gpio) < 0) -		return -1; -	bank = get_gpio_bank(gpio); -	reg = bank->base; -	switch (bank->method) { -	case METHOD_GPIO_24XX: -		input = _get_gpio_direction(bank, get_gpio_index(gpio)); -		switch (input) { -		case OMAP_GPIO_DIR_IN: -			reg += OMAP_GPIO_DATAIN; -			break; -		case OMAP_GPIO_DIR_OUT: -			reg += OMAP_GPIO_DATAOUT; -			break; -		default: -			return -1; -		} -		break; -	default: -		return -1; -	} -	return (__raw_readl(reg) -			& (1 << get_gpio_index(gpio))) != 0; -} - -/** - * Set gpio direction as input - */ -int gpio_direction_input(unsigned gpio) -{ -	const struct gpio_bank *bank; - -	if (check_gpio(gpio) < 0) -		return -1; - -	bank = get_gpio_bank(gpio); -	_set_gpio_direction(bank, get_gpio_index(gpio), 1); - -	return 0; -} - -/** - * Set gpio direction as output - */ -int gpio_direction_output(unsigned gpio, int value) -{ -	const struct gpio_bank *bank; - -	if (check_gpio(gpio) < 0) -		return -1; - -	bank = get_gpio_bank(gpio); -	_set_gpio_dataout(bank, get_gpio_index(gpio), value); -	_set_gpio_direction(bank, get_gpio_index(gpio), 0); - -	return 0; -} - -/** - * Request a gpio before using it. - * - * NOTE: Argument 'label' is unused. - */ -int gpio_request(unsigned gpio, const char *label) -{ -	if (check_gpio(gpio) < 0) -		return -1; - -	return 0; -} - -/** - * Reset and free the gpio after using it. - */ -int gpio_free(unsigned gpio) -{ -	return 0; -} diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S index ccc6bb6b8..1ece07363 100644 --- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S @@ -78,24 +78,6 @@ ENTRY(save_boot_params)  	bx	lr  ENDPROC(save_boot_params) -ENTRY(lowlevel_init) -	/* -	 * Setup a temporary stack -	 */ -	ldr	sp, =LOW_LEVEL_SRAM_STACK - -	/* -	 * Save the old lr(passed in ip) and the current lr to stack -	 */ -	push	{ip, lr} - -	/* -	 * go setup pll, mux, memory -	 */ -	bl	s_init -	pop	{ip, pc} -ENDPROC(lowlevel_init) -  ENTRY(set_pl310_ctrl_reg)  	PUSH	{r4-r11, lr}	@ save registers - ROM code may pollute  				@ our registers diff --git a/arch/arm/cpu/armv7/s5p-common/pwm.c b/arch/arm/cpu/armv7/s5p-common/pwm.c index 58d279e00..44d7bc360 100644 --- a/arch/arm/cpu/armv7/s5p-common/pwm.c +++ b/arch/arm/cpu/armv7/s5p-common/pwm.c @@ -170,7 +170,7 @@ int pwm_init(int pwm_id, int div, int invert)  	timer_rate_hz = get_pwm_clk() / ((prescaler + 1) *  			(div + 1)); -	timer_rate_hz = timer_rate_hz / 100; +	timer_rate_hz = timer_rate_hz / CONFIG_SYS_HZ;  	/* set count value */  	offset = pwm_id * 3; diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c index 359c21f5e..bb0e795e6 100644 --- a/arch/arm/cpu/armv7/s5p-common/timer.c +++ b/arch/arm/cpu/armv7/s5p-common/timer.c @@ -31,6 +31,8 @@  DECLARE_GLOBAL_DATA_PTR; +unsigned long get_current_tick(void); +  /* macro to read the 16 bit timer */  static inline struct s5p_timer *s5p_get_base_timer(void)  { @@ -44,6 +46,8 @@ int timer_init(void)  	pwm_config(4, 0, 0);  	pwm_enable(4); +	reset_timer_masked(); +  	return 0;  } @@ -72,16 +76,16 @@ void __udelay(unsigned long usec)  		 * 3. finish normalize.  		 */  		tmo = usec / 1000; -		tmo *= (CONFIG_SYS_HZ * count_value / 10); +		tmo *= (CONFIG_SYS_HZ * count_value);  		tmo /= 1000;  	} else {  		/* else small number, don't kill it prior to HZ multiply */ -		tmo = usec * CONFIG_SYS_HZ * count_value / 10; +		tmo = usec * CONFIG_SYS_HZ * count_value;  		tmo /= (1000 * 1000);  	}  	/* get current timestamp */ -	tmp = get_timer(0); +	tmp = get_current_tick();  	/* if setting this fordward will roll time stamp */  	/* reset "advancing" timestamp to 0, set lastinc value */ @@ -92,7 +96,7 @@ void __udelay(unsigned long usec)  		tmo += tmp;  	/* loop till event */ -	while (get_timer_masked() < tmo) +	while (get_current_tick() < tmo)  		;	/* nop */  } @@ -108,6 +112,14 @@ void reset_timer_masked(void)  unsigned long get_timer_masked(void)  {  	struct s5p_timer *const timer = s5p_get_base_timer(); +	unsigned long count_value = readl(&timer->tcntb4); + +	return get_current_tick() / count_value; +} + +unsigned long get_current_tick(void) +{ +	struct s5p_timer *const timer = s5p_get_base_timer();  	unsigned long now = readl(&timer->tcnto4);  	unsigned long count_value = readl(&timer->tcntb4); diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index aee27fdc4..32658eb7a 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -133,7 +133,6 @@ reset:  	orr	r0, r0, #0xd3  	msr	cpsr,r0 -#if !defined(CONFIG_TEGRA2)  /*   * Setup vector:   * (OMAP4 spl TEXT_BASE is not 32 byte aligned. @@ -149,7 +148,6 @@ reset:  	ldr	r0, =_start  	mcr	p15, 0, r0, c12, c0, 0	@Set VBAR  #endif -#endif	/* !Tegra2 */  	/* the mask ROM code should have PLL and others stable */  #ifndef CONFIG_SKIP_LOWLEVEL_INIT @@ -282,14 +280,14 @@ jump_2_ram:  /*   * Move vector table   */ -#if !defined(CONFIG_TEGRA2) +#if !defined(CONFIG_TEGRA20)  #if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))  	/* Set vector address in CP15 VBAR register */  	ldr     r0, =_start  	add     r0, r0, r9  	mcr     p15, 0, r0, c12, c0, 0  @Set VBAR  #endif -#endif /* !Tegra2 */ +#endif /* !Tegra20 */  	ldr	r0, _board_init_r_ofs  	adr	r1, _start @@ -307,6 +305,20 @@ ENDPROC(relocate_code)  /*************************************************************************   * + * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) + *	__attribute__((weak)); + * + * Stack pointer is not yet initialized at this moment + * Don't save anything to stack even if compiled with -O0 + * + *************************************************************************/ +ENTRY(save_boot_params) +	bx	lr			@ back to my caller +ENDPROC(save_boot_params) +	.weak	save_boot_params + +/************************************************************************* + *   * cpu_init_cp15   *   * Setup CP15 registers (cache, MMU, TLBs). The I-cache is turned on unless diff --git a/arch/arm/cpu/armv7/tegra2/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile index 80da4536d..5f4035d79 100644 --- a/arch/arm/cpu/armv7/tegra2/Makefile +++ b/arch/arm/cpu/armv7/tegra20/Makefile @@ -23,27 +23,16 @@  # MA 02111-1307 USA  # -# The AVP is ARMv4T architecture so we must use special compiler -# flags for any startup files it might use. -CFLAGS_arch/arm/cpu/armv7/tegra2/ap20.o += -march=armv4t -CFLAGS_arch/arm/cpu/armv7/tegra2/clock.o += -march=armv4t -CFLAGS_arch/arm/cpu/armv7/tegra2/warmboot_avp.o += -march=armv4t -  include $(TOPDIR)/config.mk  LIB	=  $(obj)lib$(SOC).o -SOBJS	:= lowlevel_init.o -COBJS-y	:= ap20.o board.o clock.o funcmux.o pinmux.o sys_info.o timer.o -COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o -COBJS-$(CONFIG_TEGRA_PMU) += pmu.o  COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o -COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o  COBJS-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o  COBJS	:= $(COBJS-y) -SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS)) +SRCS	:= $(COBJS:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS))  all:	 $(obj).depend $(LIB) diff --git a/arch/arm/cpu/armv7/tegra2/cmd_enterrcm.c b/arch/arm/cpu/armv7/tegra20/cmd_enterrcm.c index 2fcd107df..925f8414c 100644 --- a/arch/arm/cpu/armv7/tegra2/cmd_enterrcm.c +++ b/arch/arm/cpu/armv7/tegra20/cmd_enterrcm.c @@ -40,13 +40,13 @@   */  #include <common.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/pmc.h>  static int do_enterrcm(cmd_tbl_t *cmdtp, int flag, int argc,  		       char * const argv[])  { -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	puts("Entering RCM...\n");  	udelay(50000); diff --git a/arch/arm/cpu/armv7/tegra2/config.mk b/arch/arm/cpu/armv7/tegra20/config.mk index 4dd8cb844..6432e754e 100644 --- a/arch/arm/cpu/armv7/tegra2/config.mk +++ b/arch/arm/cpu/armv7/tegra20/config.mk @@ -23,16 +23,4 @@  # Foundation, Inc., 59 Temple Place, Suite 330, Boston,  # MA 02111-1307 USA  # - -# Tegra has an ARMv4T CPU which runs board_init_f(), so we must build these -# files with compatible flags -ifdef CONFIG_TEGRA2 -CFLAGS_arch/arm/lib/board.o += -march=armv4t -CFLAGS_arch/arm/lib/memset.o += -march=armv4t -CFLAGS_lib/string.o += -march=armv4t -CFLAGS_common/cmd_nvedit.o += -march=armv4t -endif - -USE_PRIVATE_LIBGCC = yes -  CONFIG_ARCH_DEVICE_TREE := tegra20 diff --git a/arch/arm/cpu/armv7/tegra2/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 5f2b24375..cac0918ff 100644 --- a/arch/arm/cpu/armv7/tegra2/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -24,7 +24,7 @@  #include <common.h>  #include <asm/io.h>  #include <asm-generic/gpio.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/clk_rst.h>  #include <asm/arch/clock.h>  #include <asm/arch/gpio.h> @@ -137,24 +137,29 @@ static const u8 utmip_elastic_limit = 16;  /* UTMIP High Speed Sync Start Delay */  static const u8 utmip_hs_sync_start_delay = 9; -/* Put the port into host mode (this only works for OTG ports) */ +/* Put the port into host mode */  static void set_host_mode(struct fdt_usb *config)  { -	if (config->dr_mode == DR_MODE_OTG) { -		/* Check whether remote host from USB1 is driving VBus */ -		if (readl(&config->reg->phy_vbus_sensors) & VBUS_VLD_STS) -			return; +	/* +	 * If we are an OTG port, check if remote host is driving VBus and +	 * bail out in this case. +	 */ +	if (config->dr_mode == DR_MODE_OTG && +		(readl(&config->reg->phy_vbus_sensors) & VBUS_VLD_STS)) +		return; -		/* -		 * If not driving, we set the GPIO to enable VBUS. We assume -		 * that the pinmux is set up correctly for this. -		 */ -		if (fdt_gpio_isvalid(&config->vbus_gpio)) { -			fdtdec_setup_gpio(&config->vbus_gpio); -			gpio_direction_output(config->vbus_gpio.gpio, 1); -			debug("set_host_mode: GPIO %d high\n", -			      config->vbus_gpio.gpio); -		} +	/* +	 * If not driving, we set the GPIO to enable VBUS. We assume +	 * that the pinmux is set up correctly for this. +	 */ +	if (fdt_gpio_isvalid(&config->vbus_gpio)) { +		fdtdec_setup_gpio(&config->vbus_gpio); +		gpio_direction_output(config->vbus_gpio.gpio, +			(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW) ? +				 0 : 1); +		debug("set_host_mode: GPIO %d %s\n", config->vbus_gpio.gpio, +			(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW) ? +				"low" : "high");  	}  } diff --git a/arch/arm/cpu/armv7/u8500/Makefile b/arch/arm/cpu/armv7/u8500/Makefile index 270aa40c8..ce8af9603 100644 --- a/arch/arm/cpu/armv7/u8500/Makefile +++ b/arch/arm/cpu/armv7/u8500/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o -COBJS	= timer.o clock.o +COBJS	= timer.o clock.o prcmu.o cpu.o  SOBJS	= lowlevel.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/cpu/armv7/u8500/clock.c b/arch/arm/cpu/armv7/u8500/clock.c index 9e3b87394..fcfd61a1f 100644 --- a/arch/arm/cpu/armv7/u8500/clock.c +++ b/arch/arm/cpu/armv7/u8500/clock.c @@ -54,3 +54,37 @@ void u8500_clock_enable(int periph, int cluster, int kern)  	if (cluster != -1)  		writel(1 << cluster, &clkrst->pcken);  } + +void db8500_clocks_init(void) +{ +	/* +	 * Enable all clocks. This is u-boot, we can enable it all. There is no +	 * powersave in u-boot. +	 */ + +	u8500_clock_enable(1, 9, -1); /* GPIO0 */ +	u8500_clock_enable(2, 11, -1);/* GPIO1 */ +	u8500_clock_enable(3, 8, -1); /* GPIO2 */ +	u8500_clock_enable(5, 1, -1); /* GPIO3 */ +	u8500_clock_enable(3, 6, 6);  /* UART2 */ +	u8500_clock_enable(3, 3, 3);  /* I2C0 */ +	u8500_clock_enable(1, 5, 5);  /* SDI0 */ +	u8500_clock_enable(2, 4, 2);  /* SDI4 */ +	u8500_clock_enable(6, 6, -1); /* MTU0 */ +	u8500_clock_enable(3, 4, 4);  /* SDI2 */ + +	/* +	 * Enabling clocks for all devices which are AMBA devices in the +	 * kernel.  Otherwise they will not get probe()'d because the +	 * peripheral ID register will not be powered. +	 */ + +	/* XXX: some of these differ between ED/V1 */ + +	u8500_clock_enable(1, 1, 1);  /* UART1 */ +	u8500_clock_enable(1, 0, 0);  /* UART0 */ +	u8500_clock_enable(3, 2, 2);  /* SSP1 */ +	u8500_clock_enable(3, 1, 1);  /* SSP0 */ +	u8500_clock_enable(2, 8, -1); /* SPI0 */ +	u8500_clock_enable(2, 5, 3);  /* MSP2 */ +} diff --git a/arch/arm/cpu/armv7/u8500/cpu.c b/arch/arm/cpu/armv7/u8500/cpu.c new file mode 100644 index 000000000..6f95c3067 --- /dev/null +++ b/arch/arm/cpu/armv7/u8500/cpu.c @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2012 Linaro Limited + * Mathieu Poirier <mathieu.poirier@linaro.org> + * + * Based on original code from Joakim Axelsson at ST-Ericsson + * (C) Copyright 2010 ST-Ericsson + * + * 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 <common.h> +#include <asm/io.h> +#include <asm/arch/prcmu.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h> + +#include <asm/arch/hardware.h> + +#define CPUID_DB8500V1		0x411fc091 +#define CPUID_DB8500V2		0x412fc091 +#define ASICID_DB8500V11	0x008500A1 + +#define CACHE_CONTR_BASE	0xA0412000 +/* Cache controller register offsets + * as found in ARM's technical reference manual + */ +#define CACHE_INVAL_BY_WAY	(CACHE_CONTR_BASE + 0x77C) +#define CACHE_LOCKDOWN_BY_D	(CACHE_CONTR_BASE + 0X900) +#define CACHE_LOCKDOWN_BY_I	(CACHE_CONTR_BASE + 0X904) + +static unsigned int read_asicid(void); + +static inline unsigned int read_cpuid(void) +{ +	unsigned int val; + +	/* Main ID register (MIDR) */ +	asm("mrc        p15, 0, %0, c0, c0, 0" +	   : "=r" (val) +	   : +	   : "cc"); + +	return val; +} + +static int cpu_is_u8500v11(void) +{ +	return read_asicid() == ASICID_DB8500V11; +} + +static int cpu_is_u8500v2(void) +{ +	return read_cpuid() == CPUID_DB8500V2; +} + +static unsigned int read_asicid(void) +{ +	unsigned int *address; + +	if (cpu_is_u8500v2()) +		address = (void *) U8500_ASIC_ID_LOC_V2; +	else +		address = (void *) U8500_ASIC_ID_LOC_ED_V1; + +	return readl(address); +} + +void cpu_cache_initialization(void) +{ +	unsigned int value; +	/* invalidate all cache entries */ +	writel(0xFFFF, CACHE_INVAL_BY_WAY); + +	/* ways are set to '0' when they are totally +	 * cleaned and invalidated +	 */ +	do { +		value = readl(CACHE_INVAL_BY_WAY); +	} while (value & 0xFF); + +	/* Invalidate register 9 D and I lockdown */ +	writel(0xFF, CACHE_LOCKDOWN_BY_D); +	writel(0xFF, CACHE_LOCKDOWN_BY_I); +} + +#ifdef CONFIG_ARCH_CPU_INIT +/* + * SOC specific cpu init + */ +int arch_cpu_init(void) +{ +	db8500_prcmu_init(); +	db8500_clocks_init(); + +	return 0; +} +#endif /* CONFIG_ARCH_CPU_INIT */ + +#ifdef CONFIG_MMC + +int u8500_mmc_power_init(void) +{ +	int ret; +	int enable, voltage; +	int ab8500_revision; + +	if (!cpu_is_u8500v11() && !cpu_is_u8500v2()) +		return 0; + +	/* Get AB8500 revision */ +	ret = ab8500_read(AB8500_MISC, AB8500_REV_REG); +	if (ret < 0) +		goto out; + +	ab8500_revision = ret; + +	/* +	 * On v1.1 HREF boards (HREF+), Vaux3 needs to be enabled for the SD +	 * card to work.  This is done by enabling the regulators in the AB8500 +	 * via PRCMU I2C transactions. +	 * +	 * This code is derived from the handling of AB8500_LDO_VAUX3 in +	 * ab8500_ldo_enable() and ab8500_ldo_disable() in Linux. +	 * +	 * Turn off and delay is required to have it work across soft reboots. +	 */ + +	/* Turn off (read-modify-write) */ +	ret = ab8500_read(AB8500_REGU_CTRL2, +				AB8500_REGU_VRF1VAUX3_REGU_REG); +	if (ret < 0) +		goto out; + +	enable = ret; + +	/* Turn off */ +	ret = ab8500_write(AB8500_REGU_CTRL2, +			AB8500_REGU_VRF1VAUX3_REGU_REG, +			enable & ~LDO_VAUX3_ENABLE_MASK); +	if (ret < 0) +		goto out; + +	udelay(10 * 1000); + +	/* Set the voltage to 2.91 V or 2.9 V without overriding VRF1 value */ +	ret = ab8500_read(AB8500_REGU_CTRL2, +			AB8500_REGU_VRF1VAUX3_SEL_REG); +	if (ret < 0) +		goto out; + +	voltage = ret; + +	if (ab8500_revision < 0x20) { +		voltage &= ~LDO_VAUX3_SEL_MASK; +		voltage |= LDO_VAUX3_SEL_2V9; +	} else { +		voltage &= ~LDO_VAUX3_V2_SEL_MASK; +		voltage |= LDO_VAUX3_V2_SEL_2V91; +	} + +	ret = ab8500_write(AB8500_REGU_CTRL2, +			AB8500_REGU_VRF1VAUX3_SEL_REG, voltage); +	if (ret < 0) +		goto out; + +	/* Turn on the supply */ +	enable &= ~LDO_VAUX3_ENABLE_MASK; +	enable |= LDO_VAUX3_ENABLE_VAL; + +	ret = ab8500_write(AB8500_REGU_CTRL2, +			AB8500_REGU_VRF1VAUX3_REGU_REG, enable); + +out: +	return ret; +} +#endif /* CONFIG_MMC */ diff --git a/arch/arm/cpu/armv7/u8500/prcmu.c b/arch/arm/cpu/armv7/u8500/prcmu.c new file mode 100644 index 000000000..934428fb8 --- /dev/null +++ b/arch/arm/cpu/armv7/u8500/prcmu.c @@ -0,0 +1,229 @@ +/* + * Copyright (C) 2009 ST-Ericsson SA + * + * Adapted from the Linux version: + * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.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., 675 Mass Ave, Cambridge, MA 02139, USA. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + */ + +/* + * NOTE: This currently does not support the I2C workaround access method. + */ + +#include <common.h> +#include <config.h> +#include <asm/io.h> +#include <asm/arch/hardware.h> +#include <asm/types.h> +#include <asm/io.h> +#include <asm/errno.h> +#include <asm/arch/prcmu.h> + +/* CPU mailbox registers */ +#define PRCMU_I2C_WRITE(slave)  \ +	(((slave) << 1) | I2CWRITE | (1 << 6)) +#define PRCMU_I2C_READ(slave) \ +	(((slave) << 1) | I2CREAD | (1 << 6)) + +#define I2C_MBOX_BIT    (1 << 5) + +static int prcmu_is_ready(void) +{ +	int ready = readb(PRCM_XP70_CUR_PWR_STATE) == AP_EXECUTE; +	if (!ready) +		printf("PRCMU firmware not ready\n"); +	return ready; +} + +static int wait_for_i2c_mbx_rdy(void) +{ +	int timeout = 10000; + +	if (readl(PRCM_ARM_IT1_VAL) & I2C_MBOX_BIT) { +		printf("prcmu: warning i2c mailbox was not acked\n"); +		/* clear mailbox 5 ack irq */ +		writel(I2C_MBOX_BIT, PRCM_ARM_IT1_CLEAR); +	} + +	/* check any already on-going transaction */ +	while ((readl(PRCM_MBOX_CPU_VAL) & I2C_MBOX_BIT) && timeout) +		timeout--; + +	if (timeout == 0) +		return -1; + +	return 0; +} + +static int wait_for_i2c_req_done(void) +{ +	int timeout = 10000; + +	/* Set an interrupt to XP70 */ +	writel(I2C_MBOX_BIT, PRCM_MBOX_CPU_SET); + +	/* wait for mailbox 5 (i2c) ack */ +	while (!(readl(PRCM_ARM_IT1_VAL) & I2C_MBOX_BIT) && timeout) +		timeout--; + +	if (timeout == 0) +		return -1; + +	return 0; +} + +/** + * prcmu_i2c_read - PRCMU - 4500 communication using PRCMU I2C + * @reg: - db8500 register bank to be accessed + * @slave:  - db8500 register to be accessed + * Returns: ACK_MB5  value containing the status + */ +int prcmu_i2c_read(u8 reg, u16 slave) +{ +	uint8_t i2c_status; +	uint8_t i2c_val; +	int ret; + +	if (!prcmu_is_ready()) +		return -1; + +	debug("\nprcmu_4500_i2c_read:bank=%x;reg=%x;\n", +			reg, slave); + +	ret = wait_for_i2c_mbx_rdy(); +	if (ret) { +		printf("prcmu_i2c_read: mailbox became not ready\n"); +		return ret; +	} + +	/* prepare the data for mailbox 5 */ +	writeb(PRCMU_I2C_READ(reg), PRCM_REQ_MB5_I2COPTYPE_REG); +	writeb((1 << 3) | 0x0, PRCM_REQ_MB5_BIT_FIELDS); +	writeb(slave, PRCM_REQ_MB5_I2CSLAVE); +	writeb(0, PRCM_REQ_MB5_I2CVAL); + +	ret = wait_for_i2c_req_done(); +	if (ret) { +		printf("prcmu_i2c_read: mailbox request timed out\n"); +		return ret; +	} + +	/* retrieve values */ +	debug("ack-mb5:transfer status = %x\n", +			readb(PRCM_ACK_MB5_STATUS)); +	debug("ack-mb5:reg bank = %x\n", readb(PRCM_ACK_MB5) >> 1); +	debug("ack-mb5:slave_add = %x\n", +			readb(PRCM_ACK_MB5_SLAVE)); +	debug("ack-mb5:reg_val = %d\n", readb(PRCM_ACK_MB5_VAL)); + +	i2c_status = readb(PRCM_ACK_MB5_STATUS); +	i2c_val = readb(PRCM_ACK_MB5_VAL); +	/* clear mailbox 5 ack irq */ +	writel(I2C_MBOX_BIT, PRCM_ARM_IT1_CLEAR); + +	if (i2c_status == I2C_RD_OK) +		return i2c_val; + +	printf("prcmu_i2c_read:read return status= %d\n", i2c_status); +	return -1; +} + +/** + * prcmu_i2c_write - PRCMU-db8500 communication using PRCMU I2C + * @reg: - db8500 register bank to be accessed + * @slave:  - db800 register to be written to + * @reg_data: - the data to write + * Returns: ACK_MB5 value containing the status + */ +int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data) +{ +	uint8_t i2c_status; +	int ret; + +	if (!prcmu_is_ready()) +		return -1; + +	debug("\nprcmu_4500_i2c_write:bank=%x;reg=%x;\n", +			reg, slave); + +	ret = wait_for_i2c_mbx_rdy(); +	if (ret) { +		printf("prcmu_i2c_write: mailbox became not ready\n"); +		return ret; +	} + +	/* prepare the data for mailbox 5 */ +	writeb(PRCMU_I2C_WRITE(reg), PRCM_REQ_MB5_I2COPTYPE_REG); +	writeb((1 << 3) | 0x0, PRCM_REQ_MB5_BIT_FIELDS); +	writeb(slave, PRCM_REQ_MB5_I2CSLAVE); +	writeb(reg_data, PRCM_REQ_MB5_I2CVAL); + +	ret = wait_for_i2c_req_done(); +	if (ret) { +		printf("prcmu_i2c_write: mailbox request timed out\n"); +		return ret; +	} + +	/* retrieve values */ +	debug("ack-mb5:transfer status = %x\n", +			readb(PRCM_ACK_MB5_STATUS)); +	debug("ack-mb5:reg bank = %x\n", readb(PRCM_ACK_MB5) >> 1); +	debug("ack-mb5:slave_add = %x\n", +			readb(PRCM_ACK_MB5_SLAVE)); +	debug("ack-mb5:reg_val = %d\n", readb(PRCM_ACK_MB5_VAL)); + +	i2c_status = readb(PRCM_ACK_MB5_STATUS); +	debug("\ni2c_status = %x\n", i2c_status); +	/* clear mailbox 5 ack irq */ +	writel(I2C_MBOX_BIT, PRCM_ARM_IT1_CLEAR); + +	if (i2c_status == I2C_WR_OK) +		return 0; + +	printf("%s: i2c_status : 0x%x\n", __func__, i2c_status); +	return -1; +} + +void u8500_prcmu_enable(u32 *reg) +{ +	writel(readl(reg) | (1 << 8), reg); +} + +void db8500_prcmu_init(void) +{ +	/* Enable timers */ +	writel(1 << 17, PRCM_TCR); + +	u8500_prcmu_enable((u32 *)PRCM_PER1CLK_MGT_REG); +	u8500_prcmu_enable((u32 *)PRCM_PER2CLK_MGT_REG); +	u8500_prcmu_enable((u32 *)PRCM_PER3CLK_MGT_REG); +	/* PER4CLK does not exist */ +	u8500_prcmu_enable((u32 *)PRCM_PER5CLK_MGT_REG); +	u8500_prcmu_enable((u32 *)PRCM_PER6CLK_MGT_REG); +	/* Only exists in ED but is always ok to write to */ +	u8500_prcmu_enable((u32 *)PRCM_PER7CLK_MGT_REG); + +	u8500_prcmu_enable((u32 *)PRCM_UARTCLK_MGT_REG); +	u8500_prcmu_enable((u32 *)PRCM_I2CCLK_MGT_REG); + +	u8500_prcmu_enable((u32 *)PRCM_SDMMCCLK_MGT_REG); + +	/* Clean up the mailbox interrupts after pre-u-boot code. */ +	writel(I2C_MBOX_BIT, PRCM_ARM_IT1_CLEAR); +} diff --git a/arch/arm/cpu/ixp/cpu.c b/arch/arm/cpu/ixp/cpu.c index 942845d54..f1864d631 100644 --- a/arch/arm/cpu/ixp/cpu.c +++ b/arch/arm/cpu/ixp/cpu.c @@ -107,28 +107,6 @@ void pci_init(void)  }  */ -#ifdef CONFIG_BOOTCOUNT_LIMIT - -void bootcount_store (ulong a) -{ -	volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR); - -	save_addr[0] = a; -	save_addr[1] = BOOTCOUNT_MAGIC; -} - -ulong bootcount_load (void) -{ -	volatile ulong *save_addr = (volatile ulong *)(CONFIG_SYS_BOOTCOUNT_ADDR); - -	if (save_addr[1] != BOOTCOUNT_MAGIC) -		return 0; -	else -		return save_addr[0]; -} - -#endif /* CONFIG_BOOTCOUNT_LIMIT */ -  int cpu_eth_init(bd_t *bis)  {  #ifdef CONFIG_IXP4XX_NPE diff --git a/arch/arm/cpu/tegra20-common/Makefile b/arch/arm/cpu/tegra20-common/Makefile new file mode 100644 index 000000000..9e91e5cb8 --- /dev/null +++ b/arch/arm/cpu/tegra20-common/Makefile @@ -0,0 +1,55 @@ +# +# (C) Copyright 2010,2011 Nvidia Corporation. +# +# (C) Copyright 2000-2008 +# Wolfgang Denk, DENX Software Engineering, wd@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 + +# The AVP is ARMv4T architecture so we must use special compiler +# flags for any startup files it might use. +CFLAGS_arch/arm/cpu/tegra20-common/warmboot_avp.o += -march=armv4t + +LIB	= $(obj)lib$(SOC)-common.o + +SOBJS += lowlevel_init.o +COBJS-y	+= ap20.o board.o clock.o funcmux.o pinmux.o sys_info.o timer.o +COBJS-$(CONFIG_TEGRA_LP0) += warmboot.o crypto.o warmboot_avp.o +COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o +COBJS-$(CONFIG_TEGRA_PMU) += pmu.o + +SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y)) + +all:	$(obj).depend $(LIB) + +$(LIB):	$(OBJS) +	$(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/tegra20-common/ap20.c b/arch/arm/cpu/tegra20-common/ap20.c new file mode 100644 index 000000000..c0ca6eb37 --- /dev/null +++ b/arch/arm/cpu/tegra20-common/ap20.c @@ -0,0 +1,131 @@ +/* +* (C) Copyright 2010-2011 +* NVIDIA Corporation <www.nvidia.com> +* +* 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 <asm/io.h> +#include <asm/arch/ap20.h> +#include <asm/arch/fuse.h> +#include <asm/arch/gp_padctrl.h> +#include <asm/arch/pmc.h> +#include <asm/arch/scu.h> +#include <asm/arch/warmboot.h> +#include <common.h> + +int tegra_get_chip_type(void) +{ +	struct apb_misc_gp_ctlr *gp; +	struct fuse_regs *fuse = (struct fuse_regs *)NV_PA_FUSE_BASE; +	uint tegra_sku_id, rev; + +	/* +	 * This is undocumented, Chip ID is bits 15:8 of the register +	 * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for +	 * Tegra30 +	 */ +	gp = (struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE; +	rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT; + +	tegra_sku_id = readl(&fuse->sku_info) & 0xff; + +	switch (rev) { +	case CHIPID_TEGRA20: +		switch (tegra_sku_id) { +		case SKU_ID_T20: +			return TEGRA_SOC_T20; +		case SKU_ID_T25SE: +		case SKU_ID_AP25: +		case SKU_ID_T25: +		case SKU_ID_AP25E: +		case SKU_ID_T25E: +			return TEGRA_SOC_T25; +		} +		break; +	} +	/* unknown sku id */ +	return TEGRA_SOC_UNKNOWN; +} + +static void enable_scu(void) +{ +	struct scu_ctlr *scu = (struct scu_ctlr *)NV_PA_ARM_PERIPHBASE; +	u32 reg; + +	/* If SCU already setup/enabled, return */ +	if (readl(&scu->scu_ctrl) & SCU_CTRL_ENABLE) +		return; + +	/* Invalidate all ways for all processors */ +	writel(0xFFFF, &scu->scu_inv_all); + +	/* Enable SCU - bit 0 */ +	reg = readl(&scu->scu_ctrl); +	reg |= SCU_CTRL_ENABLE; +	writel(reg, &scu->scu_ctrl); +} + +static u32 get_odmdata(void) +{ +	/* +	 * ODMDATA is stored in the BCT in IRAM by the BootROM. +	 * The BCT start and size are stored in the BIT in IRAM. +	 * Read the data @ bct_start + (bct_size - 12). This works +	 * on T20 and T30 BCTs, which are locked down. If this changes +	 * in new chips (T114, etc.), we can revisit this algorithm. +	 */ + +	u32 bct_start, odmdata; + +	bct_start = readl(AP20_BASE_PA_SRAM + NVBOOTINFOTABLE_BCTPTR); +	odmdata = readl(bct_start + BCT_ODMDATA_OFFSET); + +	return odmdata; +} + +static void init_pmc_scratch(void) +{ +	struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; +	u32 odmdata; +	int i; + +	/* SCRATCH0 is initialized by the boot ROM and shouldn't be cleared */ +	for (i = 0; i < 23; i++) +		writel(0, &pmc->pmc_scratch1+i); + +	/* ODMDATA is for kernel use to determine RAM size, LP config, etc. */ +	odmdata = get_odmdata(); +	writel(odmdata, &pmc->pmc_scratch20); +} + +void s_init(void) +{ +	/* Init PMC scratch memory */ +	init_pmc_scratch(); + +	enable_scu(); + +	/* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */ +	asm volatile( +		"mrc	p15, 0, r0, c1, c0, 1\n" +		"orr	r0, r0, #0x41\n" +		"mcr	p15, 0, r0, c1, c0, 1\n"); + +	/* FIXME: should have ap20's L2 disabled too? */ +} diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/tegra20-common/board.c index 923678d06..8a8d3384a 100644 --- a/arch/arm/cpu/armv7/tegra2/board.c +++ b/arch/arm/cpu/tegra20-common/board.c @@ -23,12 +23,12 @@  #include <common.h>  #include <asm/io.h> -#include <asm/arch/ap20.h>  #include <asm/arch/clock.h>  #include <asm/arch/funcmux.h>  #include <asm/arch/pmc.h>  #include <asm/arch/sys_proto.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h> +#include <asm/arch/warmboot.h>  DECLARE_GLOBAL_DATA_PTR; @@ -47,7 +47,7 @@ enum {  unsigned int query_sdram_size(void)  { -	struct pmc_ctlr *const pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	u32 reg;  	reg = readl(&pmc->pmc_scratch20); @@ -80,33 +80,12 @@ int checkboard(void)  }  #endif	/* CONFIG_DISPLAY_BOARDINFO */ -#ifdef CONFIG_ARCH_CPU_INIT -/* - * Note this function is executed by the ARM7TDMI AVP. It does not return - * in this case. It is also called once the A9 starts up, but does nothing in - * that case. - */ -int arch_cpu_init(void) -{ -	/* Fire up the Cortex A9 */ -	tegra2_start(); - -	/* We didn't do this init in start.S, so do it now */ -	cpu_init_cp15(); - -	/* Initialize essential common plls */ -	clock_early_init(); - -	return 0; -} -#endif -  static int uart_configs[] = { -#if defined(CONFIG_TEGRA2_UARTA_UAA_UAB) +#if defined(CONFIG_TEGRA_UARTA_UAA_UAB)  	FUNCMUX_UART1_UAA_UAB, -#elif defined(CONFIG_TEGRA2_UARTA_GPU) +#elif defined(CONFIG_TEGRA_UARTA_GPU)  	FUNCMUX_UART1_GPU, -#elif defined(CONFIG_TEGRA2_UARTA_SDIO1) +#elif defined(CONFIG_TEGRA_UARTA_SDIO1)  	FUNCMUX_UART1_SDIO1,  #else  	FUNCMUX_UART1_IRRX_IRTX, @@ -146,13 +125,13 @@ void board_init_uart_f(void)  {  	int uart_ids = 0;	/* bit mask of which UART ids to enable */ -#ifdef CONFIG_TEGRA2_ENABLE_UARTA +#ifdef CONFIG_TEGRA_ENABLE_UARTA  	uart_ids |= UARTA;  #endif -#ifdef CONFIG_TEGRA2_ENABLE_UARTB +#ifdef CONFIG_TEGRA_ENABLE_UARTB  	uart_ids |= UARTB;  #endif -#ifdef CONFIG_TEGRA2_ENABLE_UARTD +#ifdef CONFIG_TEGRA_ENABLE_UARTD  	uart_ids |= UARTD;  #endif  	setup_uarts(uart_ids); diff --git a/arch/arm/cpu/armv7/tegra2/clock.c b/arch/arm/cpu/tegra20-common/clock.c index 602589cde..24038745b 100644 --- a/arch/arm/cpu/armv7/tegra2/clock.c +++ b/arch/arm/cpu/tegra20-common/clock.c @@ -19,13 +19,13 @@   * MA 02111-1307 USA   */ -/* Tegra2 Clock control functions */ +/* Tegra20 Clock control functions */  #include <asm/io.h>  #include <asm/arch/clk_rst.h>  #include <asm/arch/clock.h>  #include <asm/arch/timer.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <common.h>  #include <div64.h>  #include <fdtdec.h> @@ -49,7 +49,7 @@ static unsigned osc_freq[CLOCK_OSC_FREQ_COUNT] = {  };  /* - * Clock types that we can use as a source. The Tegra2 has muxes for the + * Clock types that we can use as a source. The Tegra20 has muxes for the   * peripheral clocks, and in most cases there are four options for the clock   * source. This gives us a clock 'type' and exploits what commonality exists   * in the device. @@ -848,7 +848,7 @@ void reset_cmplx_set_enable(int cpu, int which, int reset)  			(struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;  	u32 mask; -	/* Form the mask, which depends on the cpu chosen. Tegra2 has 2 */ +	/* Form the mask, which depends on the cpu chosen. Tegra20 has 2 */  	assert(cpu >= 0 && cpu < 2);  	mask = which << cpu; @@ -976,7 +976,7 @@ void clock_ll_start_uart(enum periph_id periph_id)   * the same but we are very cautious so we check that a valid clock ID is   * provided.   * - * @param clk_id	Clock ID according to tegra2 device tree binding + * @param clk_id	Clock ID according to tegra20 device tree binding   * @return peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid   */  static enum periph_id clk_id_to_periph_id(int clk_id) diff --git a/arch/arm/cpu/armv7/tegra2/crypto.c b/arch/arm/cpu/tegra20-common/crypto.c index 5f0b240e2..5f0b240e2 100644 --- a/arch/arm/cpu/armv7/tegra2/crypto.c +++ b/arch/arm/cpu/tegra20-common/crypto.c diff --git a/arch/arm/cpu/armv7/tegra2/crypto.h b/arch/arm/cpu/tegra20-common/crypto.h index aff67e77b..aff67e77b 100644 --- a/arch/arm/cpu/armv7/tegra2/crypto.h +++ b/arch/arm/cpu/tegra20-common/crypto.h diff --git a/arch/arm/cpu/armv7/tegra2/emc.c b/arch/arm/cpu/tegra20-common/emc.c index c0e5c565f..ffc05e453 100644 --- a/arch/arm/cpu/armv7/tegra2/emc.c +++ b/arch/arm/cpu/tegra20-common/emc.c @@ -27,7 +27,7 @@  #include <asm/arch/apb_misc.h>  #include <asm/arch/clock.h>  #include <asm/arch/emc.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  /*   * The EMC registers have shadow registers.  When the EMC clock is updated diff --git a/arch/arm/cpu/armv7/tegra2/funcmux.c b/arch/arm/cpu/tegra20-common/funcmux.c index 4a31a4cf0..b2129adf2 100644 --- a/arch/arm/cpu/armv7/tegra2/funcmux.c +++ b/arch/arm/cpu/tegra20-common/funcmux.c @@ -19,7 +19,7 @@   * MA 02111-1307 USA   */ -/* Tegra2 high-level function multiplexing */ +/* Tegra20 high-level function multiplexing */  #include <common.h>  #include <asm/arch/clock.h>  #include <asm/arch/funcmux.h> @@ -234,6 +234,13 @@ int funcmux_select(enum periph_id id, int config)  		}  		break; +	case PERIPH_ID_NDFLASH: +		if (config == FUNCMUX_NDFLASH_ATC) { +			pinmux_set_func(PINGRP_ATC, PMUX_FUNC_NAND); +			pinmux_tristate_disable(PINGRP_ATC); +		} +		break; +  	default:  		debug("%s: invalid periph_id %d", __func__, id);  		return -1; diff --git a/arch/arm/cpu/armv7/tegra2/lowlevel_init.S b/arch/arm/cpu/tegra20-common/lowlevel_init.S index d117f23a6..d117f23a6 100644 --- a/arch/arm/cpu/armv7/tegra2/lowlevel_init.S +++ b/arch/arm/cpu/tegra20-common/lowlevel_init.S diff --git a/arch/arm/cpu/armv7/tegra2/pinmux.c b/arch/arm/cpu/tegra20-common/pinmux.c index b053f9060..70e84dfa1 100644 --- a/arch/arm/cpu/armv7/tegra2/pinmux.c +++ b/arch/arm/cpu/tegra20-common/pinmux.c @@ -19,10 +19,10 @@   * MA 02111-1307 USA   */ -/* Tegra2 pin multiplexing functions */ +/* Tegra20 pin multiplexing functions */  #include <asm/io.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/pinmux.h>  #include <common.h> diff --git a/arch/arm/cpu/armv7/tegra2/pmu.c b/arch/arm/cpu/tegra20-common/pmu.c index 46738023f..53505e9c5 100644 --- a/arch/arm/cpu/armv7/tegra2/pmu.c +++ b/arch/arm/cpu/tegra20-common/pmu.c @@ -25,7 +25,7 @@  #include <tps6586x.h>  #include <asm/io.h>  #include <asm/arch/ap20.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/tegra_i2c.h>  #include <asm/arch/sys_proto.h> diff --git a/arch/arm/cpu/armv7/tegra2/sys_info.c b/arch/arm/cpu/tegra20-common/sys_info.c index 6d11dc16b..1a0bb561a 100644 --- a/arch/arm/cpu/armv7/tegra2/sys_info.c +++ b/arch/arm/cpu/tegra20-common/sys_info.c @@ -27,7 +27,7 @@  /* Print CPU information */  int print_cpuinfo(void)  { -	puts("TEGRA2\n"); +	puts("TEGRA20\n");  	/* TBD: Add printf of major/minor rev info, stepping, etc. */  	return 0; diff --git a/arch/arm/cpu/armv7/tegra2/timer.c b/arch/arm/cpu/tegra20-common/timer.c index b12b12cc3..562e41401 100644 --- a/arch/arm/cpu/armv7/tegra2/timer.c +++ b/arch/arm/cpu/tegra20-common/timer.c @@ -37,7 +37,7 @@  #include <common.h>  #include <asm/io.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/timer.h>  DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/cpu/armv7/tegra2/warmboot.c b/arch/arm/cpu/tegra20-common/warmboot.c index 25d896888..6ce995ef0 100644 --- a/arch/arm/cpu/armv7/tegra2/warmboot.c +++ b/arch/arm/cpu/tegra20-common/warmboot.c @@ -29,7 +29,7 @@  #include <asm/arch/clock.h>  #include <asm/arch/pmc.h>  #include <asm/arch/pinmux.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/fuse.h>  #include <asm/arch/emc.h>  #include <asm/arch/gp_padctrl.h> @@ -39,7 +39,7 @@  DECLARE_GLOBAL_DATA_PTR;  #ifndef CONFIG_TEGRA_CLOCK_SCALING -#error "You must enable CONFIG_TEGRA_CLOCK_SCALING to use CONFIG_TEGRA2_LP0" +#error "You must enable CONFIG_TEGRA_CLOCK_SCALING to use CONFIG_TEGRA_LP0"  #endif  /* @@ -139,9 +139,9 @@ int warmboot_save_sdram_params(void)  	u32 ram_code;  	struct sdram_params sdram;  	struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	struct apb_misc_gp_ctlr *gp = -			(struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE; +			(struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;  	struct emc_ctlr *emc = emc_get_controller(gd->fdt_blob);  	union scratch2_reg scratch2;  	union scratch4_reg scratch4; @@ -205,7 +205,7 @@ static u32 get_major_version(void)  {  	u32 major_id;  	struct apb_misc_gp_ctlr *gp = -		(struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE; +		(struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;  	major_id = (readl(&gp->hidrev) & HIDREV_MAJORPREV_MASK) >>  			HIDREV_MAJORPREV_SHIFT; @@ -229,7 +229,7 @@ static int is_failure_analysis_mode(struct fuse_regs *fuse)  static int ap20_is_odm_production_mode(void)  { -	struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE; +	struct fuse_regs *fuse = (struct fuse_regs *)NV_PA_FUSE_BASE;  	if (!is_failure_analysis_mode(fuse) &&  	    is_odm_production_mode_fuse_set(fuse)) @@ -240,7 +240,7 @@ static int ap20_is_odm_production_mode(void)  static int ap20_is_production_mode(void)  { -	struct fuse_regs *fuse = (struct fuse_regs *)TEGRA2_FUSE_BASE; +	struct fuse_regs *fuse = (struct fuse_regs *)NV_PA_FUSE_BASE;  	if (get_major_version() == 0)  		return 1; @@ -257,11 +257,11 @@ static enum fuse_operating_mode fuse_get_operation_mode(void)  {  	u32 chip_id;  	struct apb_misc_gp_ctlr *gp = -		(struct apb_misc_gp_ctlr *)TEGRA2_APB_MISC_GP_BASE; +		(struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;  	chip_id = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >>  			HIDREV_CHIPID_SHIFT; -	if (chip_id == CHIPID_TEGRA2) { +	if (chip_id == CHIPID_TEGRA20) {  		if (ap20_is_odm_production_mode()) {  			printf("!! odm_production_mode is not supported !!\n");  			return MODE_UNDEFINED; diff --git a/arch/arm/cpu/armv7/tegra2/warmboot_avp.c b/arch/arm/cpu/tegra20-common/warmboot_avp.c index 70bcd8e5f..80a5a15de 100644 --- a/arch/arm/cpu/armv7/tegra2/warmboot_avp.c +++ b/arch/arm/cpu/tegra20-common/warmboot_avp.c @@ -29,7 +29,7 @@  #include <asm/arch/flow.h>  #include <asm/arch/pinmux.h>  #include <asm/arch/pmc.h> -#include <asm/arch/tegra2.h> +#include <asm/arch/tegra20.h>  #include <asm/arch/warmboot.h>  #include "warmboot_avp.h" @@ -38,7 +38,7 @@  void wb_start(void)  {  	struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; -	struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE; +	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;  	struct flow_ctlr *flow = (struct flow_ctlr *)NV_PA_FLOW_BASE;  	struct clk_rst_ctlr *clkrst =  			(struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; diff --git a/arch/arm/cpu/armv7/tegra2/warmboot_avp.h b/arch/arm/cpu/tegra20-common/warmboot_avp.h index 4b71c0784..4b71c0784 100644 --- a/arch/arm/cpu/armv7/tegra2/warmboot_avp.h +++ b/arch/arm/cpu/tegra20-common/warmboot_avp.h diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi index f95be5813..d936b1e7e 100644 --- a/arch/arm/dts/tegra20.dtsi +++ b/arch/arm/dts/tegra20.dtsi @@ -204,4 +204,11 @@  		compatible = "nvidia,tegra20-kbc";  		reg = <0x7000e200 0x0078>;  	}; + +	nand: nand-controller@70008000 { +		#address-cells = <1>; +		#size-cells = <0>; +		compatible = "nvidia,tegra20-nand"; +		reg = <0x70008000 0x100>; +	};  }; diff --git a/arch/arm/cpu/armv7/imx-common/Makefile b/arch/arm/imx-common/Makefile index bf36be576..b3e608e9d 100644 --- a/arch/arm/cpu/armv7/imx-common/Makefile +++ b/arch/arm/imx-common/Makefile @@ -27,8 +27,11 @@ include $(TOPDIR)/config.mk  LIB     = $(obj)libimx-common.o +ifeq ($(SOC),$(filter $(SOC),mx5 mx6))  COBJS-y	= iomux-v3.o timer.o cpu.o speed.o -COBJS-$(CONFIG_I2C_MXC) += i2c.o +COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o +endif +COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o  COBJS	:= $(sort $(COBJS-y))  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/imx-common/cmd_bmode.c b/arch/arm/imx-common/cmd_bmode.c new file mode 100644 index 000000000..02fe72ed7 --- /dev/null +++ b/arch/arm/imx-common/cmd_bmode.c @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2012 Boundary Devices Inc. + * + * 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 <common.h> +#include <asm/errno.h> +#include <asm/io.h> +#include <asm/imx-common/boot_mode.h> +#include <malloc.h> + +static const struct boot_mode *modes[2]; + +static const struct boot_mode *search_modes(char *arg) +{ +	int i; + +	for (i = 0; i < ARRAY_SIZE(modes); i++) { +		const struct boot_mode *p = modes[i]; +		if (p) { +			while (p->name) { +				if (!strcmp(p->name, arg)) +					return p; +				p++; +			} +		} +	} +	return NULL; +} + +static int create_usage(char *dest) +{ +	int i; +	int size = 0; + +	for (i = 0; i < ARRAY_SIZE(modes); i++) { +		const struct boot_mode *p = modes[i]; +		if (p) { +			while (p->name) { +				int len = strlen(p->name); +				if (dest) { +					memcpy(dest, p->name, len); +					dest += len; +					*dest++ = '|'; +				} +				size += len + 1; +				p++; +			} +		} +	} +	if (dest) +		memcpy(dest - 1, " [noreset]", 11);	/* include trailing 0 */ +	size += 10; +	return size; +} + +static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc, +		char * const argv[]) +{ +	const struct boot_mode *p; +	int reset_requested = 1; + +	if (argc < 2) +		return CMD_RET_USAGE; +	p = search_modes(argv[1]); +	if (!p) +		return CMD_RET_USAGE; +	if (argc == 3) { +		if (strcmp(argv[2], "noreset")) +			return CMD_RET_USAGE; +		reset_requested = 0; +	} + +	boot_mode_apply(p->cfg_val); +	if (reset_requested && p->cfg_val) +		do_reset(NULL, 0, 0, NULL); +	return 0; +} + +U_BOOT_CMD( +	bmode, 3, 0, do_boot_mode, +	NULL, +	""); + +void add_board_boot_modes(const struct boot_mode *p) +{ +	int size; +	char *dest; + +	if (__u_boot_cmd_bmode.usage) { +		free(__u_boot_cmd_bmode.usage); +		__u_boot_cmd_bmode.usage = NULL; +	} + +	modes[0] = p; +	modes[1] = soc_boot_modes; +	size = create_usage(NULL); +	dest = malloc(size); +	if (dest) { +		create_usage(dest); +		__u_boot_cmd_bmode.usage = dest; +	} +} diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index b3195dd6f..fa1d46804 100644 --- a/arch/arm/cpu/armv7/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -66,7 +66,7 @@ char *get_reset_cause(void)  #if defined(CONFIG_DISPLAY_CPUINFO) -static char *get_imx_type(u32 imxtype) +static const char *get_imx_type(u32 imxtype)  {  	switch (imxtype) {  	case 0x63: @@ -80,7 +80,7 @@ static char *get_imx_type(u32 imxtype)  	case 0x53:  		return "53";  	default: -		return "unknown"; +		return "??";  	}  } @@ -111,18 +111,16 @@ int cpu_eth_init(bd_t *bis)  	return rc;  } +#ifdef CONFIG_FSL_ESDHC  /*   * Initializes on-chip MMC controllers.   * to override, implement board_mmc_init()   */  int cpu_mmc_init(bd_t *bis)  { -#ifdef CONFIG_FSL_ESDHC  	return fsl_esdhc_mmc_init(bis); -#else -	return 0; -#endif  } +#endif  void reset_cpu(ulong addr)  { diff --git a/arch/arm/cpu/armv7/imx-common/i2c.c b/arch/arm/imx-common/i2c-mxv7.c index da2b26f43..da2b26f43 100644 --- a/arch/arm/cpu/armv7/imx-common/i2c.c +++ b/arch/arm/imx-common/i2c-mxv7.c diff --git a/arch/arm/cpu/armv7/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c index da093fbe1..da093fbe1 100644 --- a/arch/arm/cpu/armv7/imx-common/iomux-v3.c +++ b/arch/arm/imx-common/iomux-v3.c diff --git a/arch/arm/cpu/armv7/imx-common/speed.c b/arch/arm/imx-common/speed.c index 80989c498..80989c498 100644 --- a/arch/arm/cpu/armv7/imx-common/speed.c +++ b/arch/arm/imx-common/speed.c diff --git a/arch/arm/cpu/armv7/imx-common/timer.c b/arch/arm/imx-common/timer.c index 1645ff83f..e2725e1a6 100644 --- a/arch/arm/cpu/armv7/imx-common/timer.c +++ b/arch/arm/imx-common/timer.c @@ -61,7 +61,7 @@ static inline unsigned long long tick_to_time(unsigned long long tick)  static inline unsigned long long us_to_tick(unsigned long long usec)  { -	usec *= CLK_32KHZ; +	usec = usec * CLK_32KHZ + 999999;  	do_div(usec, 1000000);  	return usec; diff --git a/arch/arm/include/asm/arch-am33xx/common_def.h b/arch/arm/include/asm/arch-am33xx/common_def.h deleted file mode 100644 index aa3b55453..000000000 --- a/arch/arm/include/asm/arch-am33xx/common_def.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * common_def.h - * - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.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 version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any - * kind, whether express or implied; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __COMMON_DEF_H__ -#define __COMMON_DEF_H__ - -extern void enable_uart0_pin_mux(void); -extern void enable_mmc0_pin_mux(void); -extern void enable_i2c0_pin_mux(void); - -#endif/*__COMMON_DEF_H__ */ diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h index a027e3128..6cfbef76a 100644 --- a/arch/arm/include/asm/arch-am33xx/cpu.h +++ b/arch/arm/include/asm/arch-am33xx/cpu.h @@ -234,6 +234,39 @@ struct vtp_reg {  struct ctrl_stat {  	unsigned int resv1[16];  	unsigned int statusreg;		/* ofset 0x40 */ +	unsigned int resv2[51]; +	unsigned int secure_emif_sdram_config;	/* offset 0x0110 */ +}; + +/* AM33XX GPIO registers */ +#define OMAP_GPIO_REVISION		0x0000 +#define OMAP_GPIO_SYSCONFIG		0x0010 +#define OMAP_GPIO_SYSSTATUS		0x0114 +#define OMAP_GPIO_IRQSTATUS1		0x002c +#define OMAP_GPIO_IRQSTATUS2		0x0030 +#define OMAP_GPIO_CTRL			0x0130 +#define OMAP_GPIO_OE			0x0134 +#define OMAP_GPIO_DATAIN		0x0138 +#define OMAP_GPIO_DATAOUT		0x013c +#define OMAP_GPIO_LEVELDETECT0		0x0140 +#define OMAP_GPIO_LEVELDETECT1		0x0144 +#define OMAP_GPIO_RISINGDETECT		0x0148 +#define OMAP_GPIO_FALLINGDETECT		0x014c +#define OMAP_GPIO_DEBOUNCE_EN		0x0150 +#define OMAP_GPIO_DEBOUNCE_VAL		0x0154 +#define OMAP_GPIO_CLEARDATAOUT		0x0190 +#define OMAP_GPIO_SETDATAOUT		0x0194 + +/* Control Device Register */ +struct ctrl_dev { +	unsigned int deviceid;		/* offset 0x00 */ +	unsigned int resv1[11]; +	unsigned int macid0l;		/* offset 0x30 */ +	unsigned int macid0h;		/* offset 0x34 */ +	unsigned int macid1l;		/* offset 0x38 */ +	unsigned int macid1h;		/* offset 0x3c */ +	unsigned int resv2[4]; +	unsigned int miisel;		/* offset 0x50 */  };  #endif /* __ASSEMBLY__ */  #endif /* __KERNEL_STRICT_NAMES */ diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h index 388336f9d..6b22c45f7 100644 --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h @@ -20,158 +20,104 @@  #define _DDR_DEFS_H  #include <asm/arch/hardware.h> +#include <asm/emif.h>  /* AM335X EMIF Register values */ -#define EMIF_SDMGT		0x80000000 -#define EMIF_SDRAM		0x00004650 -#define EMIF_PHYCFG		0x2 -#define DDR_PHY_RESET		(0x1 << 10) -#define DDR_FUNCTIONAL_MODE_EN	0x1 -#define DDR_PHY_READY		(0x1 << 2)  #define VTP_CTRL_READY		(0x1 << 5)  #define VTP_CTRL_ENABLE		(0x1 << 6) -#define VTP_CTRL_LOCK_EN	(0x1 << 4)  #define VTP_CTRL_START_EN	(0x1) -#define DDR2_RATIO		0x80 -#define CMD_FORCE		0x00 -#define CMD_DELAY		0x00 +#define PHY_DLL_LOCK_DIFF	0x0 +#define DDR_CKE_CTRL_NORMAL	0x1 -#define EMIF_READ_LATENCY	0x05 -#define EMIF_TIM1		0x0666B3D6 -#define EMIF_TIM2		0x143731DA -#define EMIF_TIM3		0x00000347 -#define EMIF_SDCFG		0x43805332 -#define EMIF_SDREF		0x0000081a +#define DDR2_EMIF_READ_LATENCY	0x100005	/* Enable Dynamic Power Down */ +#define DDR2_EMIF_TIM1		0x0666B3C9 +#define DDR2_EMIF_TIM2		0x243631CA +#define DDR2_EMIF_TIM3		0x0000033F +#define DDR2_EMIF_SDCFG		0x41805332 +#define DDR2_EMIF_SDREF		0x0000081a  #define DDR2_DLL_LOCK_DIFF	0x0 -#define DDR2_RD_DQS		0x12 -#define DDR2_PHY_FIFO_WE	0x80 - +#define DDR2_RATIO		0x80  #define DDR2_INVERT_CLKOUT	0x00 +#define DDR2_RD_DQS		0x12  #define DDR2_WR_DQS		0x00  #define DDR2_PHY_WRLVL		0x00  #define DDR2_PHY_GATELVL	0x00  #define DDR2_PHY_WR_DATA	0x40 -#define PHY_RANK0_DELAY		0x01 -#define PHY_DLL_LOCK_DIFF	0x0 -#define DDR_IOCTRL_VALUE	0x18B - -/** - * This structure represents the EMIF registers on AM33XX devices. - */ -struct emif_regs { -	unsigned int sdrrev;		/* offset 0x00 */ -	unsigned int sdrstat;		/* offset 0x04 */ -	unsigned int sdrcr;		/* offset 0x08 */ -	unsigned int sdrcr2;		/* offset 0x0C */ -	unsigned int sdrrcr;		/* offset 0x10 */ -	unsigned int sdrrcsr;		/* offset 0x14 */ -	unsigned int sdrtim1;		/* offset 0x18 */ -	unsigned int sdrtim1sr;		/* offset 0x1C */ -	unsigned int sdrtim2;		/* offset 0x20 */ -	unsigned int sdrtim2sr;		/* offset 0x24 */ -	unsigned int sdrtim3;		/* offset 0x28 */ -	unsigned int sdrtim3sr;		/* offset 0x2C */ -	unsigned int res1[2]; -	unsigned int sdrmcr;		/* offset 0x38 */ -	unsigned int sdrmcsr;		/* offset 0x3C */ -	unsigned int res2[8]; -	unsigned int sdritr;		/* offset 0x60 */ -	unsigned int res3[32]; -	unsigned int ddrphycr;		/* offset 0xE4 */ -	unsigned int ddrphycsr;		/* offset 0xE8 */ -	unsigned int ddrphycr2;		/* offset 0xEC */ -}; - -/** - * Encapsulates DDR PHY control and corresponding shadow registers. - */ -struct ddr_phy_control { -	unsigned long	reg; -	unsigned long	reg_sh; -	unsigned long	reg2; -}; - -/** - * Encapsulates SDRAM timing and corresponding shadow registers. - */ -struct sdram_timing { -	unsigned long	time1; -	unsigned long	time1_sh; -	unsigned long	time2; -	unsigned long	time2_sh; -	unsigned long	time3; -	unsigned long	time3_sh; -}; +#define DDR2_PHY_FIFO_WE	0x80 +#define DDR2_PHY_RANK0_DELAY	0x1 +#define DDR2_IOCTRL_VALUE	0x18B -/** - * Encapsulates SDRAM configuration. - * (Includes refresh control registers)  */ -struct sdram_config { -	unsigned long	sdrcr; -	unsigned long	sdrcr2; -	unsigned long	refresh; -	unsigned long	refresh_sh; -}; +/* Micron MT41J128M16JT-125 */ +#define DDR3_EMIF_READ_LATENCY	0x06 +#define DDR3_EMIF_TIM1		0x0888A39B +#define DDR3_EMIF_TIM2		0x26337FDA +#define DDR3_EMIF_TIM3		0x501F830F +#define DDR3_EMIF_SDCFG		0x61C04AB2 +#define DDR3_EMIF_SDREF		0x0000093B +#define DDR3_ZQ_CFG		0x50074BE4 +#define DDR3_DLL_LOCK_DIFF	0x1 +#define DDR3_RATIO		0x40 +#define DDR3_INVERT_CLKOUT	0x1 +#define DDR3_RD_DQS		0x3B +#define DDR3_WR_DQS		0x85 +#define DDR3_PHY_WR_DATA	0xC1 +#define DDR3_PHY_FIFO_WE	0x100 +#define DDR3_IOCTRL_VALUE	0x18B  /**   * Configure SDRAM   */ -int config_sdram(struct sdram_config *cfg); +void config_sdram(const struct emif_regs *regs);  /**   * Set SDRAM timings   */ -int set_sdram_timings(struct sdram_timing *val); +void set_sdram_timings(const struct emif_regs *regs);  /**   * Configure DDR PHY   */ -int config_ddr_phy(struct ddr_phy_control *cfg); +void config_ddr_phy(const struct emif_regs *regs);  /**   * This structure represents the DDR registers on AM33XX devices. + * We make use of DDR_PHY_BASE_ADDR2 to address the DATA1 registers that + * correspond to DATA1 registers defined here.   */  struct ddr_regs {  	unsigned int resv0[7];  	unsigned int cm0csratio;	/* offset 0x01C */ -	unsigned int cm0csforce;	/* offset 0x020 */ -	unsigned int cm0csdelay;	/* offset 0x024 */ +	unsigned int resv1[2];  	unsigned int cm0dldiff;		/* offset 0x028 */  	unsigned int cm0iclkout;	/* offset 0x02C */ -	unsigned int resv1[8]; +	unsigned int resv2[8];  	unsigned int cm1csratio;	/* offset 0x050 */ -	unsigned int cm1csforce;	/* offset 0x054 */ -	unsigned int cm1csdelay;	/* offset 0x058 */ +	unsigned int resv3[2];  	unsigned int cm1dldiff;		/* offset 0x05C */  	unsigned int cm1iclkout;	/* offset 0x060 */ -	unsigned int resv2[8]; +	unsigned int resv4[8];  	unsigned int cm2csratio;	/* offset 0x084 */ -	unsigned int cm2csforce;	/* offset 0x088 */ -	unsigned int cm2csdelay;	/* offset 0x08C */ +	unsigned int resv5[2];  	unsigned int cm2dldiff;		/* offset 0x090 */  	unsigned int cm2iclkout;	/* offset 0x094 */ -	unsigned int resv3[12]; +	unsigned int resv6[12];  	unsigned int dt0rdsratio0;	/* offset 0x0C8 */ -	unsigned int dt0rdsratio1;	/* offset 0x0CC */ -	unsigned int resv4[3]; +	unsigned int resv7[4];  	unsigned int dt0wdsratio0;	/* offset 0x0DC */ -	unsigned int dt0wdsratio1;	/* offset 0x0E0 */ -	unsigned int resv5[3]; +	unsigned int resv8[4];  	unsigned int dt0wiratio0;	/* offset 0x0F0 */ -	unsigned int dt0wiratio1;	/* offset 0x0F4 */ +	unsigned int resv9; +	unsigned int dt0wimode0;	/* offset 0x0F8 */  	unsigned int dt0giratio0;	/* offset 0x0FC */ -	unsigned int dt0giratio1;	/* offset 0x100 */ -	unsigned int resv6[1]; +	unsigned int resv10; +	unsigned int dt0gimode0;	/* offset 0x104 */  	unsigned int dt0fwsratio0;	/* offset 0x108 */ -	unsigned int dt0fwsratio1;	/* offset 0x10C */ -	unsigned int resv7[4]; +	unsigned int resv11[4]; +	unsigned int dt0dqoffset;	/* offset 0x11C */  	unsigned int dt0wrsratio0;	/* offset 0x120 */ -	unsigned int dt0wrsratio1;	/* offset 0x124 */ -	unsigned int resv8[3]; +	unsigned int resv12[4];  	unsigned int dt0rdelays0;	/* offset 0x134 */  	unsigned int dt0dldiff0;	/* offset 0x138 */ -	unsigned int resv9[39]; -	unsigned int dt1rdelays0;	/* offset 0x1D8 */  };  /** @@ -200,29 +146,24 @@ struct cmd_control {   */  struct ddr_data {  	unsigned long datardsratio0; -	unsigned long datardsratio1;  	unsigned long datawdsratio0; -	unsigned long datawdsratio1;  	unsigned long datawiratio0; -	unsigned long datawiratio1;  	unsigned long datagiratio0; -	unsigned long datagiratio1;  	unsigned long datafwsratio0; -	unsigned long datafwsratio1;  	unsigned long datawrsratio0; -	unsigned long datawrsratio1; +	unsigned long datauserank0delay;  	unsigned long datadldiff0;  };  /**   * Configure DDR CMD control registers   */ -int config_cmd_ctrl(struct cmd_control *cmd); +void config_cmd_ctrl(const struct cmd_control *cmd);  /**   * Configure DDR DATA registers   */ -int config_ddr_data(int data_macrono, struct ddr_data *data); +void config_ddr_data(int data_macrono, const struct ddr_data *data);  /**   * This structure represents the DDR io control on AM33XX devices. @@ -238,20 +179,9 @@ struct ddr_cmdtctrl {  };  /** - * Encapsulates DDR CMD & DATA io control registers. - */ -struct ddr_ioctrl { -	unsigned long cmd1ctl; -	unsigned long cmd2ctl; -	unsigned long cmd3ctl; -	unsigned long data1ctl; -	unsigned long data2ctl; -}; - -/**   * Configure DDR io control registers   */ -int config_io_ctrl(struct ddr_ioctrl *ioctrl); +void config_io_ctrl(unsigned long val);  struct ddr_ctrl {  	unsigned int ddrioctrl; @@ -259,6 +189,6 @@ struct ddr_ctrl {  	unsigned int ddrckectrl;  }; -void config_ddr(void); +void config_ddr(short ddr_type);  #endif  /* _DDR_DEFS_H */ diff --git a/arch/arm/include/asm/arch-am33xx/gpio.h b/arch/arm/include/asm/arch-am33xx/gpio.h new file mode 100644 index 000000000..1a211e95e --- /dev/null +++ b/arch/arm/include/asm/arch-am33xx/gpio.h @@ -0,0 +1,29 @@ +/* + * + * 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 _GPIO_AM33xx_H +#define _GPIO_AM33xx_H + +#include <asm/omap_gpio.h> + +#define AM33XX_GPIO0_BASE       0x44E07000 +#define AM33XX_GPIO1_BASE       0x4804C000 +#define AM33XX_GPIO2_BASE       0x481AC000 +#define AM33XX_GPIO3_BASE       0x481AE000 + +#endif /* _GPIO_AM33xx_H */ diff --git a/arch/arm/include/asm/arch-am33xx/hardware.h b/arch/arm/include/asm/arch-am33xx/hardware.h index 0ec22eb91..62332f2de 100644 --- a/arch/arm/include/asm/arch-am33xx/hardware.h +++ b/arch/arm/include/asm/arch-am33xx/hardware.h @@ -19,8 +19,9 @@  #ifndef __AM33XX_HARDWARE_H  #define __AM33XX_HARDWARE_H +#include <asm/arch/omap.h> +  /* Module base addresses */ -#define LOW_LEVEL_SRAM_STACK		0x4030B7FC  #define UART0_BASE			0x44E09000  /* DM Timer base addresses */ @@ -46,6 +47,7 @@  /* Control Module Base Address */  #define CTRL_BASE			0x44E10000 +#define CTRL_DEVICE_BASE		0x44E10600  /* PRCM Base Address */  #define PRCM_BASE			0x44E00000 @@ -53,7 +55,6 @@  /* EMIF Base address */  #define EMIF4_0_CFG_BASE		0x4C000000  #define EMIF4_1_CFG_BASE		0x4D000000 -#define DMM_BASE			0x4E000000  /* PLL related registers */  #define CM_PER				0x44E00000 @@ -78,4 +79,8 @@  #define DDRPHY_0_CONFIG_BASE		(CTRL_BASE + 0x1400)  #define DDRPHY_CONFIG_BASE		DDRPHY_0_CONFIG_BASE +/* CPSW Config space */ +#define AM335X_CPSW_BASE		0x4A100000 +#define AM335X_CPSW_MDIO_BASE		0x4A101000 +  #endif /* __AM33XX_HARDWARE_H */ diff --git a/arch/arm/include/asm/arch-am33xx/mmc_host_def.h b/arch/arm/include/asm/arch-am33xx/mmc_host_def.h index 26cc300e7..1f597c0ee 100644 --- a/arch/arm/include/asm/arch-am33xx/mmc_host_def.h +++ b/arch/arm/include/asm/arch-am33xx/mmc_host_def.h @@ -20,8 +20,7 @@   * OMAP HSMMC register definitions   */  #define OMAP_HSMMC1_BASE		0x48060100 -#define OMAP_HSMMC2_BASE		0x481D8000 -#define OMAP_HSMMC3_BASE		0x47C24000 +#define OMAP_HSMMC2_BASE		0x481D8100  typedef struct hsmmc {  	unsigned char res1[0x10]; diff --git a/arch/arm/include/asm/arch-am33xx/omap.h b/arch/arm/include/asm/arch-am33xx/omap.h index fc2b7a5a2..850f8a551 100644 --- a/arch/arm/include/asm/arch-am33xx/omap.h +++ b/arch/arm/include/asm/arch-am33xx/omap.h @@ -30,7 +30,6 @@   */  #define NON_SECURE_SRAM_START	0x40304000  #define NON_SECURE_SRAM_END	0x4030E000 -#define LOW_LEVEL_SRAM_STACK	0x4030B7FC  /* ROM code defines */  /* Boot device */ diff --git a/arch/arm/include/asm/arch-am33xx/sys_proto.h b/arch/arm/include/asm/arch-am33xx/sys_proto.h index 6c58f1b30..819ea650f 100644 --- a/arch/arm/include/asm/arch-am33xx/sys_proto.h +++ b/arch/arm/include/asm/arch-am33xx/sys_proto.h @@ -19,6 +19,24 @@  #ifndef _SYS_PROTO_H_  #define _SYS_PROTO_H_ +/* + * AM335x parts define a system EEPROM that defines certain sub-fields. + * We use these fields to in turn see what board we are on, and what + * that might require us to set or not set. + */ +#define HDR_NO_OF_MAC_ADDR	3 +#define HDR_ETH_ALEN		6 +#define HDR_NAME_LEN		8 + +struct am335x_baseboard_id { +	unsigned int  magic; +	char name[HDR_NAME_LEN]; +	char version[4]; +	char serial[12]; +	char config[32]; +	char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN]; +}; +  #define BOARD_REV_ID	0x0  u32 get_cpu_rev(void); @@ -28,6 +46,18 @@ u32 get_sysboot_value(void);  int print_cpuinfo(void);  #endif +extern struct ctrl_stat *cstat;  u32 get_device_type(void);  void setup_clocks_for_console(void); +void ddr_pll_config(unsigned int ddrpll_M); + +/* + * We have three pin mux functions that must exist.  We must be able to enable + * uart0, for initial output and i2c0 to read the main EEPROM.  We then have a + * main pinmux function that can be overridden to enable all other pinmux that + * is required on the board. + */ +void enable_uart0_pin_mux(void); +void enable_i2c0_pin_mux(void); +void enable_board_pin_mux(struct am335x_baseboard_id *header);  #endif diff --git a/arch/arm/include/asm/arch-at91/at91sam9_matrix.h b/arch/arm/include/asm/arch-at91/at91sam9_matrix.h index 6d97189d2..b9a93b0c8 100644 --- a/arch/arm/include/asm/arch-at91/at91sam9_matrix.h +++ b/arch/arm/include/asm/arch-at91/at91sam9_matrix.h @@ -23,6 +23,8 @@  #include <asm/arch/at91cap9_matrix.h>  #elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)  #include <asm/arch/at91sam9g45_matrix.h> +#elif defined(CONFIG_AT91SAM9X5) +#include <asm/arch/at91sam9x5_matrix.h>  #else  #error "Unsupported AT91SAM9/CAP9 processor"  #endif diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h b/arch/arm/include/asm/arch-at91/at91sam9x5.h new file mode 100644 index 000000000..0e728c96d --- /dev/null +++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h @@ -0,0 +1,170 @@ +/* + * Chip-specific header file for the AT91SAM9x5 family + * + *  Copyright (C) 2012 Atmel Corporation. + * + * Definitions for the SoC: + * AT91SAM9x5 + * + * 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. + */ + +#ifndef __AT91SAM9X5_H__ +#define __AT91SAM9X5_H__ + +/* + * Peripheral identifiers/interrupts. + */ +#define ATMEL_ID_FIQ	0	/* Advanced Interrupt Controller (FIQ) */ +#define ATMEL_ID_SYS	1	/* System Controller Interrupt */ +#define ATMEL_ID_PIOAB	2	/* Parallel I/O Controller A and B */ +#define ATMEL_ID_PIOCD	3	/* Parallel I/O Controller C and D */ +#define ATMEL_ID_SMD	4	/* SMD Soft Modem (SMD) */ +#define ATMEL_ID_USART0	5	/* USART 0 */ +#define ATMEL_ID_USART1	6	/* USART 1 */ +#define ATMEL_ID_USART2	7	/* USART 2 */ +#define ATMEL_ID_TWI0	9	/* Two-Wire Interface 0 */ +#define ATMEL_ID_TWI1	10	/* Two-Wire Interface 1 */ +#define ATMEL_ID_TWI2	11	/* Two-Wire Interface 2 */ +#define ATMEL_ID_HSMCI0	12	/* High Speed Multimedia Card Interface 0 */ +#define ATMEL_ID_SPI0	13	/* Serial Peripheral Interface 0 */ +#define ATMEL_ID_SPI1	14	/* Serial Peripheral Interface 1 */ +#define ATMEL_ID_UART0	15	/* UART 0 */ +#define ATMEL_ID_UART1	16	/* UART 1 */ +#define ATMEL_ID_TC01	17	/* Timer Counter 0, 1, 2, 3, 4 and 5 */ +#define ATMEL_ID_PWM	18	/* Pulse Width Modulation Controller */ +#define ATMEL_ID_ADC	19	/* ADC Controller */ +#define ATMEL_ID_DMAC0	20	/* DMA Controller 0 */ +#define ATMEL_ID_DMAC1	21	/* DMA Controller 1 */ +#define ATMEL_ID_UHPHS	22	/* USB Host High Speed */ +#define ATMEL_ID_UDPHS	23	/* USB Device High Speed */ +#define ATMEL_ID_EMAC0	24	/* Ethernet MAC0 */ +#define ATMEL_ID_LCDC	25	/* LCD Controller */ +#define ATMEL_ID_HSMCI1	26	/* High Speed Multimedia Card Interface 1 */ +#define ATMEL_ID_EMAC1	27	/* Ethernet MAC1 */ +#define ATMEL_ID_SSC	28	/* Synchronous Serial Controller */ +#define ATMEL_ID_IRQ	31	/* Advanced Interrupt Controller */ + +/* + * User Peripheral physical base addresses. + */ +#define ATMEL_BASE_SPI0		0xf0000000 +#define ATMEL_BASE_SPI1		0xf0004000 +#define ATMEL_BASE_HSMCI0	0xf0008000 +#define ATMEL_BASE_HSMCI1	0xf000c000 +#define ATMEL_BASE_SSC		0xf0010000 +#define ATMEL_BASE_CAN0		0xf8000000 +#define ATMEL_BASE_CAN1		0xf8004000 +#define ATMEL_BASE_TC0		0xf8008000 +#define ATMEL_BASE_TC1		0xf8008040 +#define ATMEL_BASE_TC2		0xf8008080 +#define ATMEL_BASE_TC3		0xf800c000 +#define ATMEL_BASE_TC4		0xf800c040 +#define ATMEL_BASE_TC5		0xf800c080 +#define ATMEL_BASE_TWI0		0xf8010000 +#define ATMEL_BASE_TWI1		0xf8014000 +#define ATMEL_BASE_TWI2		0xf8018000 +#define ATMEL_BASE_USART0	0xf801c000 +#define ATMEL_BASE_USART1	0xf8020000 +#define ATMEL_BASE_USART2	0xf8024000 +#define ATMEL_BASE_USART3	0xf8028000 +#define ATMEL_BASE_EMAC0	0xf802c000 +#define ATMEL_BASE_EMAC1	0xf8030000 +#define ATMEL_BASE_PWM		0xf8034000 +#define ATMEL_BASE_LCDC		0xf8038000 +#define ATMEL_BASE_UDPHS	0xf803c000 +#define ATMEL_BASE_UART0	0xf8040000 +#define ATMEL_BASE_UART1	0xf8044000 +#define ATMEL_BASE_ISI		0xf8048000 +#define ATMEL_BASE_ADC		0xf804c000 +#define ATMEL_BASE_SYS		0xffffc000 + +/* + * System Peripherals + */ +#define ATMEL_BASE_MATRIX	0xffffde00 +#define ATMEL_BASE_PMECC	0xffffe000 +#define ATMEL_BASE_PMERRLOC	0xffffe600 +#define ATMEL_BASE_DDRSDRC	0xffffe800 +#define ATMEL_BASE_SMC		0xffffea00 +#define ATMEL_BASE_DMAC0	0xffffec00 +#define ATMEL_BASE_DMAC1	0xffffee00 +#define ATMEL_BASE_AIC		0xfffff000 +#define ATMEL_BASE_DBGU		0xfffff200 +#define ATMEL_BASE_PIOA		0xfffff400 +#define ATMEL_BASE_PIOB		0xfffff600 +#define ATMEL_BASE_PIOC		0xfffff800 +#define ATMEL_BASE_PIOD		0xfffffa00 +#define ATMEL_BASE_PMC		0xfffffc00 +#define ATMEL_BASE_RSTC		0xfffffe00 +#define ATMEL_BASE_SHDWC	0xfffffe10 +#define ATMEL_BASE_PIT		0xfffffe30 +#define ATMEL_BASE_WDT		0xfffffe40 +#define ATMEL_BASE_GPBR		0xfffffe60 +#define ATMEL_BASE_RTC		0xfffffeb0 + +/* + * Internal Memory. + */ +#define ATMEL_BASE_ROM		0x00100000 /* Internal ROM base address */ +#define ATMEL_BASE_SRAM		0x00300000 /* Internal SRAM base address */ +#define ATMEL_BASE_SMD		0x00400000 /* SMD Controller */ +#define ATMEL_BASE_UDPHS_FIFO	0x00500000 /* USB Device HS controller */ +#define ATMEL_BASE_OHCI		0x00600000 /* USB Host controller (OHCI) */ +#define ATMEL_BASE_EHCI		0x00700000 /* USB Host controller (EHCI) */ + +/* 9x5 series chip id definitions */ +#define ARCH_ID_AT91SAM9X5	0x819a05a0 +#define ARCH_ID_VERSION_MASK	0x1f +#define ARCH_EXID_AT91SAM9G15	0x00000000 +#define ARCH_EXID_AT91SAM9G35	0x00000001 +#define ARCH_EXID_AT91SAM9X35	0x00000002 +#define ARCH_EXID_AT91SAM9G25	0x00000003 +#define ARCH_EXID_AT91SAM9X25	0x00000004 + +#define cpu_is_at91sam9x5()	(get_chip_id() == ARCH_ID_AT91SAM9X5) +#define cpu_is_at91sam9g15()	(cpu_is_at91sam9x5() && \ +			(get_extension_chip_id() == ARCH_EXID_AT91SAM9G15)) +#define cpu_is_at91sam9g25()	(cpu_is_at91sam9x5() && \ +			(get_extension_chip_id() == ARCH_EXID_AT91SAM9G25)) +#define cpu_is_at91sam9g35()	(cpu_is_at91sam9x5() && \ +			(get_extension_chip_id() == ARCH_EXID_AT91SAM9G35)) +#define cpu_is_at91sam9x25()	(cpu_is_at91sam9x5() && \ +			(get_extension_chip_id() == ARCH_EXID_AT91SAM9X25)) +#define cpu_is_at91sam9x35()	(cpu_is_at91sam9x5() && \ +			(get_extension_chip_id() == ARCH_EXID_AT91SAM9X35)) + +/* + * Cpu Name + */ +#define CONFIG_SYS_AT91_G15_CPU_NAME	"AT91SAM9G15" +#define CONFIG_SYS_AT91_G25_CPU_NAME	"AT91SAM9G25" +#define CONFIG_SYS_AT91_G35_CPU_NAME	"AT91SAM9G35" +#define CONFIG_SYS_AT91_X25_CPU_NAME	"AT91SAM9X25" +#define CONFIG_SYS_AT91_X35_CPU_NAME	"AT91SAM9X35" +#define CONFIG_SYS_AT91_UNKNOWN_CPU	"Unknown CPU type" +#define ATMEL_CPU_NAME	get_cpu_name() + +/* + * Other misc defines + */ +#define ATMEL_PIO_PORTS         4 +#define CPU_HAS_PIO3 +#define PIO_SCDR_DIV            (0x3fff <<  0)  /* Slow Clock Divider Mask */ + +/* + * at91sam9x5 specific prototypes + */ +#ifndef __ASSEMBLY__ +unsigned int get_chip_id(void); +unsigned int get_extension_chip_id(void); +unsigned int has_emac1(void); +unsigned int has_emac0(void); +unsigned int has_lcdc(void); +char *get_cpu_name(void); +#endif + +#endif diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5_matrix.h b/arch/arm/include/asm/arch-at91/at91sam9x5_matrix.h new file mode 100644 index 000000000..d6ce6fad5 --- /dev/null +++ b/arch/arm/include/asm/arch-at91/at91sam9x5_matrix.h @@ -0,0 +1,91 @@ +/* + * Matrix-centric header file for the AT91SAM9X5 family + * + *  Copyright (C) 2012 Atmel Corporation. + * + * Memory Controllers (MATRIX, EBI) - System peripherals registers. + * Based on AT91SAM9X5 preliminary datasheet. + * + * 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. + */ + +#ifndef __AT91SAM9X5_MATRIX_H__ +#define __AT91SAM9X5_MATRIX_H__ + +#ifndef __ASSEMBLY__ + +struct at91_matrix { +	u32	mcfg[16]; +	u32	scfg[16]; +	u32	pras[16][2]; +	u32	mrcr;           /* 0x100 Master Remap Control */ +	u32	filler[7]; +	u32	ebicsa; +	u32	filler4[47]; +	u32	wpmr; +	u32	wpsr; +}; + +#endif /* __ASSEMBLY__ */ + +#define AT91_MATRIX_ULBT_INFINITE	(0 << 0) +#define AT91_MATRIX_ULBT_SINGLE		(1 << 0) +#define AT91_MATRIX_ULBT_FOUR		(2 << 0) +#define AT91_MATRIX_ULBT_EIGHT		(3 << 0) +#define AT91_MATRIX_ULBT_SIXTEEN	(4 << 0) +#define AT91_MATRIX_ULBT_THIRTYTWO	(5 << 0) +#define AT91_MATRIX_ULBT_SIXTYFOUR	(6 << 0) +#define AT91_MATRIX_ULBT_128		(7 << 0) + +#define AT91_MATRIX_DEFMSTR_TYPE_NONE	(0 << 16) +#define AT91_MATRIX_DEFMSTR_TYPE_LAST	(1 << 16) +#define AT91_MATRIX_DEFMSTR_TYPE_FIXED	(2 << 16) +#define AT91_MATRIX_FIXED_DEFMSTR_SHIFT 18 + +#define AT91_MATRIX_M0PR_SHIFT          0 +#define AT91_MATRIX_M1PR_SHIFT          4 +#define AT91_MATRIX_M2PR_SHIFT          8 +#define AT91_MATRIX_M3PR_SHIFT          12 +#define AT91_MATRIX_M4PR_SHIFT          16 +#define AT91_MATRIX_M5PR_SHIFT          20 +#define AT91_MATRIX_M6PR_SHIFT          24 +#define AT91_MATRIX_M7PR_SHIFT          28 + +#define AT91_MATRIX_M8PR_SHIFT          0  /* register B */ +#define AT91_MATRIX_M9PR_SHIFT          4  /* register B */ +#define AT91_MATRIX_M10PR_SHIFT         8  /* register B */ +#define AT91_MATRIX_M11PR_SHIFT         12 /* register B */ + +#define AT91_MATRIX_RCB0                (1 << 0) +#define AT91_MATRIX_RCB1                (1 << 1) +#define AT91_MATRIX_RCB2                (1 << 2) +#define AT91_MATRIX_RCB3                (1 << 3) +#define AT91_MATRIX_RCB4                (1 << 4) +#define AT91_MATRIX_RCB5                (1 << 5) +#define AT91_MATRIX_RCB6                (1 << 6) +#define AT91_MATRIX_RCB7                (1 << 7) +#define AT91_MATRIX_RCB8                (1 << 8) +#define AT91_MATRIX_RCB9                (1 << 9) +#define AT91_MATRIX_RCB10               (1 << 10) + +#define AT91_MATRIX_EBI_CS1A_SMC                (0 << 1) +#define AT91_MATRIX_EBI_CS1A_SDRAMC             (1 << 1) +#define AT91_MATRIX_EBI_CS3A_SMC                (0 << 3) +#define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA     (1 << 3) +#define AT91_MATRIX_EBI_DBPU_ON                 (0 << 8) +#define AT91_MATRIX_EBI_DBPU_OFF                (1 << 8) +#define AT91_MATRIX_EBI_DBPD_ON                 (0 << 9) +#define AT91_MATRIX_EBI_DBPD_OFF                (1 << 9) +#define AT91_MATRIX_EBI_VDDIOMSEL_1_8V          (0 << 16) +#define AT91_MATRIX_EBI_VDDIOMSEL_3_3V          (1 << 16) +#define AT91_MATRIX_EBI_EBI_IOSR_REDUCED        (0 << 17) +#define AT91_MATRIX_EBI_EBI_IOSR_NORMAL         (1 << 17) +#define AT91_MATRIX_NFD0_ON_D0                  (0 << 24) +#define AT91_MATRIX_NFD0_ON_D16                 (1 << 24) +#define AT91_MATRIX_MP_OFF                      (0 << 25) +#define AT91_MATRIX_MP_ON                       (1 << 25) + +#endif diff --git a/arch/arm/include/asm/arch-at91/hardware.h b/arch/arm/include/asm/arch-at91/hardware.h index 85c2889e5..4c4ee703a 100644 --- a/arch/arm/include/asm/arch-at91/hardware.h +++ b/arch/arm/include/asm/arch-at91/hardware.h @@ -37,6 +37,8 @@  # include <asm/arch/at91sam9rl.h>  #elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)  # include <asm/arch/at91sam9g45.h> +#elif defined(CONFIG_AT91SAM9X5) +# include <asm/arch/at91sam9x5.h>  #elif defined(CONFIG_AT91CAP9)  # include <asm/arch/at91cap9.h>  #elif defined(CONFIG_AT91X40) diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h b/arch/arm/include/asm/arch-bcm2835/gpio.h new file mode 100644 index 000000000..0e708560a --- /dev/null +++ b/arch/arm/include/asm/arch-bcm2835/gpio.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Vikram Narayananan + * <vikram186@gmail.com> + * + * 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. + */ + +#ifndef _BCM2835_GPIO_H_ +#define _BCM2835_GPIO_H_ + +#define BCM2835_GPIO_BASE		0x20200000 +#define BCM2835_GPIO_COUNT		54 + +#define BCM2835_GPIO_FSEL_MASK		0x7 +#define BCM2835_GPIO_INPUT		0x0 +#define BCM2835_GPIO_OUTPUT		0x1 +#define BCM2835_GPIO_ALT0		0x4 +#define BCM2835_GPIO_ALT1		0x5 +#define BCM2835_GPIO_ALT2		0x6 +#define BCM2835_GPIO_ALT3		0x7 +#define BCM2835_GPIO_ALT4		0x3 +#define BCM2835_GPIO_ALT5		0x2 + +#define BCM2835_GPIO_COMMON_BANK(gpio)	((gpio < 32) ? 0 : 1) +#define BCM2835_GPIO_COMMON_SHIFT(gpio)	(gpio & 0x1f) + +#define BCM2835_GPIO_FSEL_BANK(gpio)	(gpio / 10) +#define BCM2835_GPIO_FSEL_SHIFT(gpio)	((gpio % 10) * 3) + +struct bcm2835_gpio_regs { +	u32 gpfsel[6]; +	u32 reserved1; +	u32 gpset[2]; +	u32 reserved2; +	u32 gpclr[2]; +	u32 reserved3; +	u32 gplev[2]; +	u32 reserved4; +	u32 gpeds[2]; +	u32 reserved5; +	u32 gpren[2]; +	u32 reserved6; +	u32 gpfen[2]; +	u32 reserved7; +	u32 gphen[2]; +	u32 reserved8; +	u32 gplen[2]; +	u32 reserved9; +	u32 gparen[2]; +	u32 reserved10; +	u32 gppud; +	u32 gppudclk[2]; +}; + +#endif /* _BCM2835_GPIO_H_ */ diff --git a/arch/arm/include/asm/arch-bcm2835/timer.h b/arch/arm/include/asm/arch-bcm2835/timer.h new file mode 100644 index 000000000..30c70e03d --- /dev/null +++ b/arch/arm/include/asm/arch-bcm2835/timer.h @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#ifndef _BCM2835_TIMER_H +#define _BCM2835_TIMER_H + +#define BCM2835_TIMER_PHYSADDR	0x20003000 + +struct bcm2835_timer_regs { +	u32 cs; +	u32 clo; +	u32 chi; +	u32 c0; +	u32 c1; +	u32 c2; +	u32 c3; +}; + +#define BCM2835_TIMER_CS_M3	(1 << 3) +#define BCM2835_TIMER_CS_M2	(1 << 2) +#define BCM2835_TIMER_CS_M1	(1 << 1) +#define BCM2835_TIMER_CS_M0	(1 << 0) + +#endif diff --git a/arch/arm/include/asm/arch-bcm2835/wdog.h b/arch/arm/include/asm/arch-bcm2835/wdog.h new file mode 100644 index 000000000..303a65f32 --- /dev/null +++ b/arch/arm/include/asm/arch-bcm2835/wdog.h @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2012 Stephen Warren + * + * 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 + * version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#ifndef _BCM2835_TIMER_H +#define _BCM2835_TIMER_H + +#define BCM2835_WDOG_PHYSADDR			0x20100000 + +struct bcm2835_wdog_regs { +	u32 unknown0[7]; +	u32 rstc; +	u32 unknown1; +	u32 wdog; +}; + +#define BCM2835_WDOG_PASSWORD			0x5a000000 + +#define BCM2835_WDOG_RSTC_WRCFG_MASK		0x00000030 +#define BCM2835_WDOG_RSTC_WRCFG_FULL_RESET	0x00000020 + +#define BCM2835_WDOG_WDOG_TIMEOUT_MASK		0x0000ffff + +#endif diff --git a/arch/arm/include/asm/arch-davinci/da8xx-usb.h b/arch/arm/include/asm/arch-davinci/da8xx-usb.h new file mode 100644 index 000000000..eb79bf8b9 --- /dev/null +++ b/arch/arm/include/asm/arch-davinci/da8xx-usb.h @@ -0,0 +1,105 @@ +/* + * da8xx-usb.h -- TI's DA8xx platform specific usb wrapper definitions. + * + * Author: Ajay Kumar Gupta <ajay.gupta@ti.com> + * + * Based on drivers/usb/musb/davinci.h + * + * Copyright (C) 2009 Texas Instruments Incorporated + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef __DA8XX_MUSB_H__ +#define __DA8XX_MUSB_H__ + +#include <asm/arch/hardware.h> +#include <asm/arch/gpio.h> + +/* Base address of da8xx usb0 wrapper */ +#define DA8XX_USB_OTG_BASE  0x01E00000 + +/* Base address of da8xx musb core */ +#define DA8XX_USB_OTG_CORE_BASE (DA8XX_USB_OTG_BASE + 0x400) + +/* Timeout for DA8xx usb module */ +#define DA8XX_USB_OTG_TIMEOUT 0x3FFFFFF + +/* + * DA8xx platform USB wrapper register overlay. + */ +struct da8xx_usb_regs { +	dv_reg	revision; +	dv_reg	control; +	dv_reg 	status; +	dv_reg 	emulation; +	dv_reg 	mode; +	dv_reg 	autoreq; +	dv_reg 	srpfixtime; +	dv_reg 	teardown; +	dv_reg 	intsrc; +	dv_reg 	intsrc_set; +	dv_reg 	intsrc_clr; +	dv_reg 	intmsk; +	dv_reg 	intmsk_set; +	dv_reg 	intmsk_clr; +	dv_reg 	intsrcmsk; +	dv_reg 	eoi; +	dv_reg 	intvector; +	dv_reg 	grndis_size[4]; +}; + +#define da8xx_usb_regs ((struct da8xx_usb_regs *)DA8XX_USB_OTG_BASE) + +/* DA8XX interrupt bits definitions */ +#define DA8XX_USB_TX_ENDPTS_MASK  0x1f	/* ep0 + 4 tx */ +#define DA8XX_USB_RX_ENDPTS_MASK  0x1e	/* 4 rx */ +#define DA8XX_USB_TXINT_SHIFT	  0 +#define DA8XX_USB_RXINT_SHIFT	  8 + +#define DA8XX_USB_USBINT_MASK	  0x01ff0000	/* 8 Mentor, DRVVBUS */ +#define DA8XX_USB_TXINT_MASK \ +		(DA8XX_USB_TX_ENDPTS_MASK << DA8XX_USB_TXINT_SHIFT) +#define DA8XX_USB_RXINT_MASK \ +		(DA8XX_USB_RX_ENDPTS_MASK << DA8XX_USB_RXINT_SHIFT) + +/* DA8xx CFGCHIP2 (USB 2.0 PHY Control) register bits */ +#define CFGCHIP2_PHYCLKGD	(1 << 17) +#define CFGCHIP2_VBUSSENSE	(1 << 16) +#define CFGCHIP2_RESET		(1 << 15) +#define CFGCHIP2_OTGMODE	(3 << 13) +#define CFGCHIP2_NO_OVERRIDE	(0 << 13) +#define CFGCHIP2_FORCE_HOST	(1 << 13) +#define CFGCHIP2_FORCE_DEVICE 	(2 << 13) +#define CFGCHIP2_FORCE_HOST_VBUS_LOW (3 << 13) +#define CFGCHIP2_USB1PHYCLKMUX	(1 << 12) +#define CFGCHIP2_USB2PHYCLKMUX	(1 << 11) +#define CFGCHIP2_PHYPWRDN	(1 << 10) +#define CFGCHIP2_OTGPWRDN	(1 << 9) +#define CFGCHIP2_DATPOL 	(1 << 8) +#define CFGCHIP2_USB1SUSPENDM	(1 << 7) +#define CFGCHIP2_PHY_PLLON	(1 << 6)	/* override PLL suspend */ +#define CFGCHIP2_SESENDEN	(1 << 5)	/* Vsess_end comparator */ +#define CFGCHIP2_VBDTCTEN	(1 << 4)	/* Vbus comparator */ +#define CFGCHIP2_REFFREQ	(0xf << 0) +#define CFGCHIP2_REFFREQ_12MHZ	(1 << 0) +#define CFGCHIP2_REFFREQ_24MHZ	(2 << 0) +#define CFGCHIP2_REFFREQ_48MHZ	(3 << 0) + +#define DA8XX_USB_VBUS_GPIO	(1 << 15) + +int usb_phy_on(void); +void usb_phy_off(void); + +#endif	/* __DA8XX_MUSB_H__ */ diff --git a/arch/arm/include/asm/arch-davinci/hardware.h b/arch/arm/include/asm/arch-davinci/hardware.h index b145c6e7f..6eed6c95a 100644 --- a/arch/arm/include/asm/arch-davinci/hardware.h +++ b/arch/arm/include/asm/arch-davinci/hardware.h @@ -306,6 +306,7 @@ typedef volatile unsigned int *	dv_reg_p;  void lpsc_on(unsigned int id);  void lpsc_syncreset(unsigned int id); +void lpsc_disable(unsigned int id);  void dsp_on(void);  void davinci_enable_uart0(void); @@ -441,21 +442,51 @@ struct davinci_pllc_regs {  #define davinci_pllc1_regs ((struct davinci_pllc_regs *)DAVINCI_PLL_CNTRL1_BASE)  #define DAVINCI_PLLC_DIV_MASK	0x1f -#define ASYNC3          get_async3_src() -#define PLL1_SYSCLK2		((1 << 16) | 0x2) -#define DAVINCI_SPI1_CLKID  (cpu_is_da830() ? 2 : ASYNC3) -/* Clock IDs */ +/* + * A clock ID is a 32-bit number where bit 16 represents the PLL controller + * (clear is PLLC0, set is PLLC1) and the low 16 bits represent the divisor, + * counting from 1. Clock IDs may be passed to clk_get(). + */ + +/* flags to select PLL controller */ +#define DAVINCI_PLLC0_FLAG			(0) +#define DAVINCI_PLLC1_FLAG			(1 << 16) +  enum davinci_clk_ids { -	DAVINCI_SPI0_CLKID = 2, -	DAVINCI_UART2_CLKID = 2, -	DAVINCI_MMC_CLKID = 2, -	DAVINCI_MDIO_CLKID = 4, -	DAVINCI_ARM_CLKID = 6, -	DAVINCI_PLLM_CLKID = 0xff, -	DAVINCI_PLLC_CLKID = 0x100, -	DAVINCI_AUXCLK_CLKID = 0x101 +	/* +	 * Clock IDs for PLL outputs. Each may be switched on/off +	 * independently, and each may map to one or more peripherals. +	 */ +	DAVINCI_PLL0_SYSCLK2			= DAVINCI_PLLC0_FLAG | 2, +	DAVINCI_PLL0_SYSCLK4			= DAVINCI_PLLC0_FLAG | 4, +	DAVINCI_PLL0_SYSCLK6			= DAVINCI_PLLC0_FLAG | 6, +	DAVINCI_PLL1_SYSCLK1			= DAVINCI_PLLC1_FLAG | 1, +	DAVINCI_PLL1_SYSCLK2			= DAVINCI_PLLC1_FLAG | 2, + +	/* map peripherals to clock IDs */ +	DAVINCI_ARM_CLKID			= DAVINCI_PLL0_SYSCLK6, +	DAVINCI_DDR_CLKID			= DAVINCI_PLL1_SYSCLK1, +	DAVINCI_MDIO_CLKID			= DAVINCI_PLL0_SYSCLK4, +	DAVINCI_MMC_CLKID			= DAVINCI_PLL0_SYSCLK2, +	DAVINCI_SPI0_CLKID			= DAVINCI_PLL0_SYSCLK2, +	DAVINCI_MMCSD_CLKID			= DAVINCI_PLL0_SYSCLK2, + +	/* special clock ID - output of PLL multiplier */ +	DAVINCI_PLLM_CLKID			= 0x0FF, + +	/* special clock ID - output of PLL post divisor */ +	DAVINCI_PLLC_CLKID			= 0x100, + +	/* special clock ID - PLL bypass */ +	DAVINCI_AUXCLK_CLKID			= 0x101,  }; +#define DAVINCI_UART2_CLKID	(cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \ +						: get_async3_src()) + +#define DAVINCI_SPI1_CLKID	(cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \ +						: get_async3_src()) +  int clk_get(enum davinci_clk_ids id);  /* Boot config */ @@ -505,6 +536,7 @@ struct davinci_syscfg1_regs {  	((struct davinci_syscfg1_regs *)DAVINCI_SYSCFG1_BASE)  #define DDR_SLEW_CMOSEN_BIT	4 +#define DDR_SLEW_DDR_PDENA_BIT	5  #define VTP_POWERDWN		(1 << 6)  #define VTP_LOCK		(1 << 7) @@ -570,10 +602,10 @@ static inline int cpu_is_da850(void)  	return ((part_no == 0xb7d1) ? 1 : 0);  } -static inline int get_async3_src(void) +static inline enum davinci_clk_ids get_async3_src(void)  {  	return (REG(&davinci_syscfg_regs->cfgchip3) & 0x10) ? -			PLL1_SYSCLK2 : 2; +			DAVINCI_PLL1_SYSCLK2 : DAVINCI_PLL0_SYSCLK2;  }  #endif /* CONFIG_SOC_DA8XX */ diff --git a/arch/arm/include/asm/arch-davinci/pinmux_defs.h b/arch/arm/include/asm/arch-davinci/pinmux_defs.h index 07aceaab0..a851f1f50 100644 --- a/arch/arm/include/asm/arch-davinci/pinmux_defs.h +++ b/arch/arm/include/asm/arch-davinci/pinmux_defs.h @@ -28,6 +28,7 @@ extern const struct pinmux_config spi1_pins_base[3];  extern const struct pinmux_config spi1_pins_scs0[1];  /* UART pin muxer settings */ +extern const struct pinmux_config uart0_pins_txrx[2];  extern const struct pinmux_config uart1_pins_txrx[2];  extern const struct pinmux_config uart2_pins_txrx[2];  extern const struct pinmux_config uart2_pins_rtscts[2]; @@ -48,4 +49,7 @@ extern const struct pinmux_config emifa_pins_cs4[1];  extern const struct pinmux_config emifa_pins_nand[12];  extern const struct pinmux_config emifa_pins_nor[43]; +/* MMC pin muxer settings */ +extern const struct pinmux_config mmc0_pins[6]; +  #endif diff --git a/arch/arm/include/asm/arch-exynos/clk.h b/arch/arm/include/asm/arch-exynos/clk.h index 72dc655ec..552902573 100644 --- a/arch/arm/include/asm/arch-exynos/clk.h +++ b/arch/arm/include/asm/arch-exynos/clk.h @@ -27,6 +27,7 @@  #define EPLL	2  #define HPLL	3  #define VPLL	4 +#define BPLL	5  unsigned long get_pll_clk(int pllreg);  unsigned long get_arm_clk(void); diff --git a/arch/arm/include/asm/arch-exynos/clock.h b/arch/arm/include/asm/arch-exynos/clock.h index 50da95803..fce38efbb 100644 --- a/arch/arm/include/asm/arch-exynos/clock.h +++ b/arch/arm/include/asm/arch-exynos/clock.h @@ -273,8 +273,7 @@ struct exynos5_clock {  	unsigned int	clkout_cmu_cpu_div_stat;  	unsigned char	res8[0x5f8];  	unsigned int	armclk_stopctrl; -	unsigned int	atclk_stopctrl; -	unsigned char	res9[0x8]; +	unsigned char	res9[0x0c];  	unsigned int	parityfail_status;  	unsigned int	parityfail_clear;  	unsigned char	res10[0x8]; @@ -323,259 +322,283 @@ struct exynos5_clock {  	unsigned char	res19[0xf8];  	unsigned int	div_core0;  	unsigned int	div_core1; -	unsigned char	res20[0xf8]; +	unsigned int	div_sysrgt; +	unsigned char	res20[0xf4];  	unsigned int	div_stat_core0;  	unsigned int	div_stat_core1; -	unsigned char	res21[0x2f8]; +	unsigned int	div_stat_sysrgt; +	unsigned char	res21[0x2f4];  	unsigned int	gate_ip_core; -	unsigned char	res22[0xfc]; +	unsigned int	gate_ip_sysrgt; +	unsigned char	res22[0x8]; +	unsigned int	c2c_monitor; +	unsigned char	res23[0xec];  	unsigned int	clkout_cmu_core;  	unsigned int	clkout_cmu_core_div_stat; -	unsigned char	res23[0x5f8]; +	unsigned char	res24[0x5f8];  	unsigned int	dcgidx_map0;  	unsigned int	dcgidx_map1;  	unsigned int	dcgidx_map2; -	unsigned char	res24[0x14]; +	unsigned char	res25[0x14];  	unsigned int	dcgperf_map0;  	unsigned int	dcgperf_map1; -	unsigned char	res25[0x18]; +	unsigned char	res26[0x18];  	unsigned int	dvcidx_map; -	unsigned char	res26[0x1c]; +	unsigned char	res27[0x1c];  	unsigned int	freq_cpu;  	unsigned int	freq_dpm; -	unsigned char	res27[0x18]; +	unsigned char	res28[0x18];  	unsigned int	dvsemclk_en;  	unsigned int	maxperf; -	unsigned char	res28[0x3478]; +	unsigned char	res29[0xf78]; +	unsigned int	c2c_config; +	unsigned char	res30[0x24fc];  	unsigned int	div_acp; -	unsigned char	res29[0xfc]; +	unsigned char	res31[0xfc];  	unsigned int	div_stat_acp; -	unsigned char	res30[0x1fc]; +	unsigned char	res32[0x1fc];  	unsigned int	gate_ip_acp; -	unsigned char	res31[0x1fc]; +	unsigned char	res33[0xfc]; +	unsigned int	div_syslft; +	unsigned char	res34[0xc]; +	unsigned int	div_stat_syslft; +	unsigned char	res35[0x1c]; +	unsigned int	gate_ip_syslft; +	unsigned char	res36[0xcc];  	unsigned int	clkout_cmu_acp;  	unsigned int	clkout_cmu_acp_div_stat; -	unsigned char	res32[0x38f8]; +	unsigned char	res37[0x8]; +	unsigned int	ufmc_config; +	unsigned char	res38[0x38ec];  	unsigned int	div_isp0;  	unsigned int	div_isp1;  	unsigned int	div_isp2; -	unsigned char	res33[0xf4]; +	unsigned char	res39[0xf4];  	unsigned int	div_stat_isp0;  	unsigned int	div_stat_isp1;  	unsigned int	div_stat_isp2; -	unsigned char	res34[0x3f4]; +	unsigned char	res40[0x3f4];  	unsigned int	gate_ip_isp0;  	unsigned int	gate_ip_isp1; -	unsigned char	res35[0xf8]; +	unsigned char	res41[0xf8];  	unsigned int	gate_sclk_isp; -	unsigned char	res36[0xc]; +	unsigned char	res42[0xc];  	unsigned int	mcuisp_pwr_ctrl; -	unsigned char	res37[0xec]; +	unsigned char	res43[0xec];  	unsigned int	clkout_cmu_isp;  	unsigned int	clkout_cmu_isp_div_stat; -	unsigned char	res38[0x3618]; +	unsigned char	res44[0x3618];  	unsigned int	cpll_lock; -	unsigned char	res39[0xc]; +	unsigned char	res45[0xc];  	unsigned int	epll_lock; -	unsigned char	res40[0xc]; +	unsigned char	res46[0xc];  	unsigned int	vpll_lock; -	unsigned char	res41[0xdc]; +	unsigned char	res47[0xc]; +	unsigned int	gpll_lock; +	unsigned char	res48[0xcc];  	unsigned int	cpll_con0;  	unsigned int	cpll_con1; -	unsigned char	res42[0x8]; +	unsigned char	res49[0x8];  	unsigned int	epll_con0;  	unsigned int	epll_con1;  	unsigned int	epll_con2; -	unsigned char	res43[0x4]; +	unsigned char	res50[0x4];  	unsigned int	vpll_con0;  	unsigned int	vpll_con1;  	unsigned int	vpll_con2; -	unsigned char	res44[0xc4]; +	unsigned char	res51[0x4]; +	unsigned int	gpll_con0; +	unsigned int	gpll_con1; +	unsigned char	res52[0xb8];  	unsigned int	src_top0;  	unsigned int	src_top1;  	unsigned int	src_top2;  	unsigned int	src_top3;  	unsigned int	src_gscl; -	unsigned int	src_disp0_0; -	unsigned int	src_disp0_1; +	unsigned char	res53[0x8];  	unsigned int	src_disp1_0; -	unsigned int	src_disp1_1; -	unsigned char	res46[0xc]; +	unsigned char	res54[0x10];  	unsigned int	src_mau;  	unsigned int	src_fsys; -	unsigned char	res47[0x8]; +	unsigned int	src_gen; +	unsigned char	res55[0x4];  	unsigned int	src_peric0;  	unsigned int	src_peric1; -	unsigned char	res48[0x18]; +	unsigned char	res56[0x18];  	unsigned int	sclk_src_isp; -	unsigned char	res49[0x9c]; +	unsigned char	res57[0x9c];  	unsigned int	src_mask_top; -	unsigned char	res50[0xc]; +	unsigned char	res58[0xc];  	unsigned int	src_mask_gscl; -	unsigned int	src_mask_disp0_0; -	unsigned int	src_mask_disp0_1; +	unsigned char	res59[0x8];  	unsigned int	src_mask_disp1_0; -	unsigned int	src_mask_disp1_1; -	unsigned int	src_mask_maudio; -	unsigned char	res52[0x8]; +	unsigned char	res60[0x4]; +	unsigned int	src_mask_mau; +	unsigned char	res61[0x8];  	unsigned int	src_mask_fsys; -	unsigned char	res53[0xc]; +	unsigned int	src_mask_gen; +	unsigned char	res62[0x8];  	unsigned int	src_mask_peric0;  	unsigned int	src_mask_peric1; -	unsigned char	res54[0x18]; +	unsigned char	res63[0x18];  	unsigned int	src_mask_isp; -	unsigned char	res55[0x9c]; +	unsigned char	res67[0x9c];  	unsigned int	mux_stat_top0;  	unsigned int	mux_stat_top1;  	unsigned int	mux_stat_top2;  	unsigned int	mux_stat_top3; -	unsigned char	res56[0xf0]; +	unsigned char	res68[0xf0];  	unsigned int	div_top0;  	unsigned int	div_top1; -	unsigned char	res57[0x8]; +	unsigned char	res69[0x8];  	unsigned int	div_gscl; -	unsigned int	div_disp0_0; -	unsigned int	div_disp0_1; +	unsigned char	res70[0x8];  	unsigned int	div_disp1_0; -	unsigned int	div_disp1_1; -	unsigned char	res59[0x8]; +	unsigned char	res71[0xc];  	unsigned int	div_gen; -	unsigned char	res60[0x4]; +	unsigned char	res72[0x4];  	unsigned int	div_mau;  	unsigned int	div_fsys0;  	unsigned int	div_fsys1;  	unsigned int	div_fsys2; -	unsigned int	div_fsys3; +	unsigned char	res73[0x4];  	unsigned int	div_peric0;  	unsigned int	div_peric1;  	unsigned int	div_peric2;  	unsigned int	div_peric3;  	unsigned int	div_peric4;  	unsigned int	div_peric5; -	unsigned char	res61[0x10]; +	unsigned char	res74[0x10];  	unsigned int	sclk_div_isp; -	unsigned char	res62[0xc]; +	unsigned char	res75[0xc];  	unsigned int	div2_ratio0;  	unsigned int	div2_ratio1; -	unsigned char	res63[0x8]; +	unsigned char	res76[0x8];  	unsigned int	div4_ratio; -	unsigned char	res64[0x6c]; +	unsigned char	res77[0x6c];  	unsigned int	div_stat_top0;  	unsigned int	div_stat_top1; -	unsigned char	res65[0x8]; +	unsigned char	res78[0x8];  	unsigned int	div_stat_gscl; -	unsigned int	div_stat_disp0_0; -	unsigned int	div_stat_disp0_1; +	unsigned char	res79[0x8];  	unsigned int	div_stat_disp1_0; -	unsigned int	div_stat_disp1_1; -	unsigned char	res67[0x8]; +	unsigned char	res80[0xc];  	unsigned int	div_stat_gen; -	unsigned char	res68[0x4]; -	unsigned int	div_stat_maudio; +	unsigned char	res81[0x4]; +	unsigned int	div_stat_mau;  	unsigned int	div_stat_fsys0;  	unsigned int	div_stat_fsys1;  	unsigned int	div_stat_fsys2; -	unsigned int	div_stat_fsys3; +	unsigned char	res82[0x4];  	unsigned int	div_stat_peric0;  	unsigned int	div_stat_peric1;  	unsigned int	div_stat_peric2;  	unsigned int	div_stat_peric3;  	unsigned int	div_stat_peric4;  	unsigned int	div_stat_peric5; -	unsigned char	res69[0x10]; +	unsigned char	res83[0x10];  	unsigned int	sclk_div_stat_isp; -	unsigned char	res70[0xc]; +	unsigned char	res84[0xc];  	unsigned int	div2_stat0;  	unsigned int	div2_stat1; -	unsigned char	res71[0x8]; +	unsigned char	res85[0x8];  	unsigned int	div4_stat; -	unsigned char	res72[0x180]; -	unsigned int	gate_top_sclk_disp0; +	unsigned char	res86[0x184];  	unsigned int	gate_top_sclk_disp1;  	unsigned int	gate_top_sclk_gen; -	unsigned char	res74[0xc]; +	unsigned char	res87[0xc];  	unsigned int	gate_top_sclk_mau;  	unsigned int	gate_top_sclk_fsys; -	unsigned char	res75[0xc]; +	unsigned char	res88[0xc];  	unsigned int	gate_top_sclk_peric; -	unsigned char	res76[0x1c]; +	unsigned char	res89[0x1c];  	unsigned int	gate_top_sclk_isp; -	unsigned char	res77[0xac]; +	unsigned char	res90[0xac];  	unsigned int	gate_ip_gscl; -	unsigned int	gate_ip_disp0; +	unsigned char	res91[0x4];  	unsigned int	gate_ip_disp1;  	unsigned int	gate_ip_mfc;  	unsigned int	gate_ip_g3d;  	unsigned int	gate_ip_gen; -	unsigned char	res79[0xc]; +	unsigned char	res92[0xc];  	unsigned int	gate_ip_fsys; -	unsigned char	res80[0x4]; -	unsigned int	gate_ip_gps; +	unsigned char	res93[0x8];  	unsigned int	gate_ip_peric; -	unsigned char	res81[0xc]; +	unsigned char	res94[0xc];  	unsigned int	gate_ip_peris; -	unsigned char	res82[0x1c]; +	unsigned char	res95[0x1c];  	unsigned int	gate_block; -	unsigned char	res83[0x7c]; +	unsigned char	res96[0x1c]; +	unsigned int	mcuiop_pwr_ctrl; +	unsigned char	res97[0x5c];  	unsigned int	clkout_cmu_top;  	unsigned int	clkout_cmu_top_div_stat; -	unsigned char	res84[0x37f8]; +	unsigned char	res98[0x37f8];  	unsigned int	src_lex; -	unsigned char	res85[0x2fc]; +	unsigned char	res99[0x1fc]; +	unsigned int	mux_stat_lex; +	unsigned char	res100[0xfc];  	unsigned int	div_lex; -	unsigned char	res86[0xfc]; +	unsigned char	res101[0xfc];  	unsigned int	div_stat_lex; -	unsigned char	res87[0x1fc]; +	unsigned char	res102[0x1fc];  	unsigned int	gate_ip_lex; -	unsigned char	res88[0x1fc]; +	unsigned char	res103[0x1fc];  	unsigned int	clkout_cmu_lex;  	unsigned int	clkout_cmu_lex_div_stat; -	unsigned char	res89[0x3af8]; +	unsigned char	res104[0x3af8];  	unsigned int	div_r0x; -	unsigned char	res90[0xfc]; +	unsigned char	res105[0xfc];  	unsigned int	div_stat_r0x; -	unsigned char	res91[0x1fc]; +	unsigned char	res106[0x1fc];  	unsigned int	gate_ip_r0x; -	unsigned char	res92[0x1fc]; +	unsigned char	res107[0x1fc];  	unsigned int	clkout_cmu_r0x;  	unsigned int	clkout_cmu_r0x_div_stat; -	unsigned char	res94[0x3af8]; +	unsigned char	res108[0x3af8];  	unsigned int	div_r1x; -	unsigned char	res95[0xfc]; +	unsigned char	res109[0xfc];  	unsigned int	div_stat_r1x; -	unsigned char	res96[0x1fc]; +	unsigned char	res110[0x1fc];  	unsigned int	gate_ip_r1x; -	unsigned char	res97[0x1fc]; +	unsigned char	res111[0x1fc];  	unsigned int	clkout_cmu_r1x;  	unsigned int	clkout_cmu_r1x_div_stat; -	unsigned char	res98[0x3608]; +	unsigned char	res112[0x3608];  	unsigned int	bpll_lock; -	unsigned char	res99[0xfc]; +	unsigned char	res113[0xfc];  	unsigned int	bpll_con0;  	unsigned int	bpll_con1; -	unsigned char	res100[0xe8]; +	unsigned char	res114[0xe8];  	unsigned int	src_cdrex; -	unsigned char	res101[0x1fc]; +	unsigned char	res115[0x1fc];  	unsigned int	mux_stat_cdrex; -	unsigned char	res102[0xfc]; +	unsigned char	res116[0xfc];  	unsigned int	div_cdrex; -	unsigned int	div_cdrex2; -	unsigned char	res103[0xf8]; +	unsigned char	res117[0xfc];  	unsigned int	div_stat_cdrex; -	unsigned char	res104[0x2fc]; +	unsigned char	res118[0x2fc];  	unsigned int	gate_ip_cdrex; -	unsigned char	res105[0xc]; -	unsigned int	c2c_monitor; -	unsigned int	dmc_pwr_ctrl; -	unsigned char	res106[0x4]; +	unsigned char	res119[0x10]; +	unsigned int	dmc_freq_ctrl; +	unsigned char	res120[0x4];  	unsigned int	drex2_pause; -	unsigned char	res107[0xe0]; +	unsigned char	res121[0xe0];  	unsigned int	clkout_cmu_cdrex;  	unsigned int	clkout_cmu_cdrex_div_stat; -	unsigned char	res108[0x8]; +	unsigned char	res122[0x8];  	unsigned int	lpddr3phy_ctrl; -	unsigned char	res109[0xf5f8]; +	unsigned int	lpddr3phy_con0; +	unsigned int	lpddr3phy_con1; +	unsigned int	lpddr3phy_con2; +	unsigned int	lpddr3phy_con3; +	unsigned int	pll_div2_sel; +	unsigned char	res123[0xf5d8];  };  #endif +#define MPLL_FOUT_SEL_SHIFT	4 +#define MPLL_FOUT_SEL_MASK	0x1 +#define BPLL_FOUT_SEL_SHIFT	0 +#define BPLL_FOUT_SEL_MASK	0x1  #endif diff --git a/arch/arm/include/asm/arch-exynos/cpu.h b/arch/arm/include/asm/arch-exynos/cpu.h index 0e6ea8707..2cd4ae152 100644 --- a/arch/arm/include/asm/arch-exynos/cpu.h +++ b/arch/arm/include/asm/arch-exynos/cpu.h @@ -56,6 +56,7 @@  #define EXYNOS4_USBPHY_CONTROL		0x10020704  #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE +#define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE  /* EXYNOS5 */  #define EXYNOS5_I2C_SPACING		0x10000 @@ -83,6 +84,7 @@  #define EXYNOS5_PWMTIMER_BASE		0x12DD0000  #define EXYNOS5_GPIO_PART2_BASE		0x13400000  #define EXYNOS5_FIMD_BASE		0x14400000 +#define EXYNOS5_DP_BASE			0x145B0000  #define EXYNOS5_ADC_BASE		DEVICE_NOT_AVAILABLE  #define EXYNOS5_MODEM_BASE		DEVICE_NOT_AVAILABLE @@ -150,6 +152,7 @@ static inline unsigned int samsung_get_base_##device(void)	\  SAMSUNG_BASE(adc, ADC_BASE)  SAMSUNG_BASE(clock, CLOCK_BASE) +SAMSUNG_BASE(dp, DP_BASE)  SAMSUNG_BASE(sysreg, SYSREG_BASE)  SAMSUNG_BASE(fimd, FIMD_BASE)  SAMSUNG_BASE(i2c, I2C_BASE) diff --git a/arch/arm/include/asm/arch-exynos/dmc.h b/arch/arm/include/asm/arch-exynos/dmc.h index bd52d16c9..f65c676cc 100644 --- a/arch/arm/include/asm/arch-exynos/dmc.h +++ b/arch/arm/include/asm/arch-exynos/dmc.h @@ -251,5 +251,70 @@ struct exynos5_phy_control {  	unsigned int phy_con41;  	unsigned int phy_con42;  }; + +enum ddr_mode { +	DDR_MODE_DDR2, +	DDR_MODE_DDR3, +	DDR_MODE_LPDDR2, +	DDR_MODE_LPDDR3, + +	DDR_MODE_COUNT, +}; + +enum mem_manuf { +	MEM_MANUF_AUTODETECT, +	MEM_MANUF_ELPIDA, +	MEM_MANUF_SAMSUNG, + +	MEM_MANUF_COUNT, +}; + +/* CONCONTROL register fields */ +#define CONCONTROL_DFI_INIT_START_SHIFT	28 +#define CONCONTROL_RD_FETCH_SHIFT	12 +#define CONCONTROL_RD_FETCH_MASK	(0x7 << CONCONTROL_RD_FETCH_SHIFT) +#define CONCONTROL_AREF_EN_SHIFT	5 + +/* PRECHCONFIG register field */ +#define PRECHCONFIG_TP_CNT_SHIFT	24 + +/* PWRDNCONFIG register field */ +#define PWRDNCONFIG_DPWRDN_CYC_SHIFT	0 +#define PWRDNCONFIG_DSREF_CYC_SHIFT	16 + +/* PHY_CON0 register fields */ +#define PHY_CON0_T_WRRDCMD_SHIFT	17 +#define PHY_CON0_T_WRRDCMD_MASK		(0x7 << PHY_CON0_T_WRRDCMD_SHIFT) +#define PHY_CON0_CTRL_DDR_MODE_SHIFT	11 + +/* PHY_CON1 register fields */ +#define PHY_CON1_RDLVL_RDDATA_ADJ_SHIFT	0 + +/* PHY_CON12 register fields */ +#define PHY_CON12_CTRL_START_POINT_SHIFT	24 +#define PHY_CON12_CTRL_INC_SHIFT	16 +#define PHY_CON12_CTRL_FORCE_SHIFT	8 +#define PHY_CON12_CTRL_START_SHIFT	6 +#define PHY_CON12_CTRL_START_MASK	(1 << PHY_CON12_CTRL_START_SHIFT) +#define PHY_CON12_CTRL_DLL_ON_SHIFT	5 +#define PHY_CON12_CTRL_DLL_ON_MASK	(1 << PHY_CON12_CTRL_DLL_ON_SHIFT) +#define PHY_CON12_CTRL_REF_SHIFT	1 + +/* PHY_CON16 register fields */ +#define PHY_CON16_ZQ_MODE_DDS_SHIFT	24 +#define PHY_CON16_ZQ_MODE_DDS_MASK	(0x7 << PHY_CON16_ZQ_MODE_DDS_SHIFT) + +#define PHY_CON16_ZQ_MODE_TERM_SHIFT 21 +#define PHY_CON16_ZQ_MODE_TERM_MASK	(0x7 << PHY_CON16_ZQ_MODE_TERM_SHIFT) + +#define PHY_CON16_ZQ_MODE_NOTERM_MASK	(1 << 19) + +/* PHY_CON42 register fields */ +#define PHY_CON42_CTRL_BSTLEN_SHIFT	8 +#define PHY_CON42_CTRL_BSTLEN_MASK	(0xff << PHY_CON42_CTRL_BSTLEN_SHIFT) + +#define PHY_CON42_CTRL_RDLAT_SHIFT	0 +#define PHY_CON42_CTRL_RDLAT_MASK	(0x1f << PHY_CON42_CTRL_RDLAT_SHIFT) +  #endif  #endif diff --git a/arch/arm/include/asm/arch-exynos/dp.h b/arch/arm/include/asm/arch-exynos/dp.h new file mode 100644 index 000000000..69c65f7a7 --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/dp.h @@ -0,0 +1,751 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * Author: Donghwa Lee <dh09.lee@samsung.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 + */ + +#ifndef __ASM_ARM_ARCH_DP_H_ +#define __ASM_ARM_ARCH_DP_H_ + +#ifndef __ASSEMBLY__ + +struct exynos_dp { +	unsigned char	res1[0x10]; +	unsigned int	tx_version; +	unsigned int	tx_sw_reset; +	unsigned int	func_en1; +	unsigned int	func_en2; +	unsigned int	video_ctl1; +	unsigned int	video_ctl2; +	unsigned int	video_ctl3; +	unsigned int	video_ctl4; +	unsigned int	color_blue_cb; +	unsigned int	color_green_y; +	unsigned int	color_red_cr; +	unsigned int	video_ctl8; +	unsigned char	res2[0x4]; +	unsigned int	video_ctl10; +	unsigned int	total_ln_cfg_l; +	unsigned int	total_ln_cfg_h; +	unsigned int	active_ln_cfg_l; +	unsigned int	active_ln_cfg_h; +	unsigned int	vfp_cfg; +	unsigned int	vsw_cfg; +	unsigned int	vbp_cfg; +	unsigned int	total_pix_cfg_l; +	unsigned int	total_pix_cfg_h; +	unsigned int	active_pix_cfg_l; +	unsigned int	active_pix_cfg_h; +	unsigned int	hfp_cfg_l; +	unsigned int	hfp_cfg_h; +	unsigned int	hsw_cfg_l; +	unsigned int	hsw_cfg_h; +	unsigned int	hbp_cfg_l; +	unsigned int	hbp_cfg_h; +	unsigned int	video_status; +	unsigned int	total_ln_sta_l; +	unsigned int	total_ln_sta_h; +	unsigned int	active_ln_sta_l; +	unsigned int	active_ln_sta_h; + +	unsigned int	vfp_sta; +	unsigned int	vsw_sta; +	unsigned int	vbp_sta; + +	unsigned int	total_pix_sta_l; +	unsigned int	total_pix_sta_h; +	unsigned int	active_pix_sta_l; +	unsigned int	active_pix_sta_h; + +	unsigned int	hfp_sta_l; +	unsigned int	hfp_sta_h; +	unsigned int	hsw_sta_l; +	unsigned int	hsw_sta_h; +	unsigned int	hbp_sta_l; +	unsigned int	hbp_sta_h; + +	unsigned char	res3[0x288]; + +	unsigned int	lane_map; +	unsigned char	res4[0x10]; +	unsigned int	analog_ctl1; +	unsigned int	analog_ctl2; +	unsigned int	analog_ctl3; + +	unsigned int	pll_filter_ctl1; +	unsigned int	amp_tuning_ctl; +	unsigned char	res5[0xc]; + +	unsigned int	aux_hw_retry_ctl; +	unsigned char	res6[0x2c]; +	unsigned int	int_state; +	unsigned int	common_int_sta1; +	unsigned int	common_int_sta2; +	unsigned int	common_int_sta3; +	unsigned int	common_int_sta4; +	unsigned char	res7[0x8]; + +	unsigned int	int_sta; +	unsigned char	res8[0x1c]; +	unsigned int	int_ctl; +	unsigned char	res9[0x200]; +	unsigned int	sys_ctl1; +	unsigned int	sys_ctl2; +	unsigned int	sys_ctl3; +	unsigned int	sys_ctl4; +	unsigned int	vid_ctl; +	unsigned char	res10[0x2c]; +	unsigned int	pkt_send_ctl; +	unsigned char	res[0x4]; +	unsigned int	hdcp_ctl; +	unsigned char	res11[0x34]; +	unsigned int	link_bw_set; + +	unsigned int	lane_count_set; +	unsigned int	training_ptn_set; +	unsigned int	ln0_link_training_ctl; +	unsigned int	ln1_link_training_ctl; +	unsigned int	ln2_link_training_ctl; +	unsigned int	ln3_link_training_ctl; +	unsigned int	dn_spread_ctl; +	unsigned int	hw_link_training_ctl; +	unsigned char	res12[0x1c]; + +	unsigned int	debug_ctl; +	unsigned int	hpd_deglitch_l; +	unsigned int	hpd_deglitch_h; + +	unsigned char	res13[0x14]; +	unsigned int	link_debug_ctl; + +	unsigned char	res14[0x1c]; + +	unsigned int	m_vid0; +	unsigned int	m_vid1; +	unsigned int	m_vid2; +	unsigned int	n_vid0; +	unsigned int	n_vid1; +	unsigned int	n_vid2; +	unsigned int	m_vid_mon; +	unsigned int	pll_ctl; +	unsigned int	phy_pd; +	unsigned int	phy_test; +	unsigned char	res15[0x8]; + +	unsigned int	video_fifo_thrd; +	unsigned char	res16[0x8]; +	unsigned int	audio_margin; + +	unsigned int	dn_spread_ctl1; +	unsigned int	dn_spread_ctl2; +	unsigned char	res17[0x18]; +	unsigned int	m_cal_ctl; +	unsigned int	m_vid_gen_filter_th; +	unsigned char	res18[0x10]; +	unsigned int	m_aud_gen_filter_th; +	unsigned char	res50[0x4]; + +	unsigned int	aux_ch_sta; +	unsigned int	aux_err_num; +	unsigned int	aux_ch_defer_ctl; +	unsigned int	aux_rx_comm; +	unsigned int	buffer_data_ctl; + +	unsigned int	aux_ch_ctl1; +	unsigned int	aux_addr_7_0; +	unsigned int	aux_addr_15_8; +	unsigned int	aux_addr_19_16; +	unsigned int	aux_ch_ctl2; +	unsigned char	res19[0x18]; +	unsigned int	buf_data0; +	unsigned char	res20[0x3c]; + +	unsigned int	soc_general_ctl; +	unsigned char	res21[0x8c]; +	unsigned int	crc_con; +	unsigned int	crc_result; +	unsigned char	res22[0x8]; + +	unsigned int	common_int_mask1; +	unsigned int	common_int_mask2; +	unsigned int	common_int_mask3; +	unsigned int	common_int_mask4; +	unsigned int	int_sta_mask1; +	unsigned int	int_sta_mask2; +	unsigned int	int_sta_mask3; +	unsigned int	int_sta_mask4; +	unsigned int	int_sta_mask; +	unsigned int	crc_result2; +	unsigned int	scrambler_reset_cnt; + +	unsigned int	pn_inv; +	unsigned int	psr_config; +	unsigned int	psr_command0; +	unsigned int	psr_command1; +	unsigned int	psr_crc_mon0; +	unsigned int	psr_crc_mon1; + +	unsigned char	res24[0x30]; +	unsigned int	phy_bist_ctrl; +	unsigned char	res25[0xc]; +	unsigned int	phy_ctrl; +	unsigned char	res26[0x1c]; +	unsigned int	test_pattern_gen_en; +	unsigned int	test_pattern_gen_ctrl; +}; + +#endif	/* __ASSEMBLY__ */ + +/* For DP VIDEO CTL 1 */ +#define VIDEO_EN_MASK				(0x01 << 7) +#define VIDEO_MUTE_MASK				(0x01 << 6) + +/* For DP VIDEO CTL 4 */ +#define VIDEO_BIST_MASK				(0x1 << 3) + +/* EXYNOS_DP_ANALOG_CTL_1 */ +#define SEL_BG_NEW_BANDGAP			(0x0 << 6) +#define SEL_BG_INTERNAL_RESISTOR		(0x1 << 6) +#define TX_TERMINAL_CTRL_73_OHM			(0x0 << 4) +#define TX_TERMINAL_CTRL_61_OHM			(0x1 << 4) +#define TX_TERMINAL_CTRL_50_OHM			(0x2 << 4) +#define TX_TERMINAL_CTRL_45_OHM			(0x3 << 4) +#define SWING_A_30PER_G_INCREASE		(0x1 << 3) +#define SWING_A_30PER_G_NORMAL			(0x0 << 3) + +/* EXYNOS_DP_ANALOG_CTL_2 */ +#define CPREG_BLEED				(0x1 << 4) +#define SEL_24M					(0x1 << 3) +#define TX_DVDD_BIT_1_0000V			(0x3 << 0) +#define TX_DVDD_BIT_1_0625V			(0x4 << 0) +#define TX_DVDD_BIT_1_1250V			(0x5 << 0) + +/* EXYNOS_DP_ANALOG_CTL_3 */ +#define DRIVE_DVDD_BIT_1_0000V			(0x3 << 5) +#define DRIVE_DVDD_BIT_1_0625V			(0x4 << 5) +#define DRIVE_DVDD_BIT_1_1250V			(0x5 << 5) +#define SEL_CURRENT_DEFAULT			(0x0 << 3) +#define VCO_BIT_000_MICRO			(0x0 << 0) +#define VCO_BIT_200_MICRO			(0x1 << 0) +#define VCO_BIT_300_MICRO			(0x2 << 0) +#define VCO_BIT_400_MICRO			(0x3 << 0) +#define VCO_BIT_500_MICRO			(0x4 << 0) +#define VCO_BIT_600_MICRO			(0x5 << 0) +#define VCO_BIT_700_MICRO			(0x6 << 0) +#define VCO_BIT_900_MICRO			(0x7 << 0) + +/* EXYNOS_DP_PLL_FILTER_CTL_1 */ +#define PD_RING_OSC				(0x1 << 6) +#define AUX_TERMINAL_CTRL_52_OHM		(0x3 << 4) +#define AUX_TERMINAL_CTRL_69_OHM		(0x2 << 4) +#define AUX_TERMINAL_CTRL_102_OHM		(0x1 << 4) +#define AUX_TERMINAL_CTRL_200_OHM		(0x0 << 4) +#define TX_CUR1_1X				(0x0 << 2) +#define TX_CUR1_2X				(0x1 << 2) +#define TX_CUR1_3X				(0x2 << 2) +#define TX_CUR_1_MA				(0x0 << 0) +#define TX_CUR_2_MA			        (0x1 << 0) +#define TX_CUR_3_MA				(0x2 << 0) +#define TX_CUR_4_MA				(0x3 << 0) + +/* EXYNOS_DP_PLL_FILTER_CTL_2 */ +#define CH3_AMP_0_MV				(0x3 << 12) +#define CH2_AMP_0_MV				(0x3 << 8) +#define CH1_AMP_0_MV				(0x3 << 4) +#define CH0_AMP_0_MV				(0x3 << 0) + +/* EXYNOS_DP_PLL_CTL */ +#define DP_PLL_PD			        (0x1 << 7) +#define DP_PLL_RESET				(0x1 << 6) +#define DP_PLL_LOOP_BIT_DEFAULT		        (0x1 << 4) +#define DP_PLL_REF_BIT_1_1250V			(0x5 << 0) +#define DP_PLL_REF_BIT_1_2500V		        (0x7 << 0) + +/* EXYNOS_DP_INT_CTL */ +#define SOFT_INT_CTRL				(0x1 << 2) +#define INT_POL					(0x1 << 0) + +/* DP TX SW RESET */ +#define RESET_DP_TX				(0x01 << 0) + +/* DP FUNC_EN_1 */ +#define MASTER_VID_FUNC_EN_N			(0x1 << 7) +#define SLAVE_VID_FUNC_EN_N			(0x1 << 5) +#define AUD_FIFO_FUNC_EN_N			(0x1 << 4) +#define AUD_FUNC_EN_N				(0x1 << 3) +#define HDCP_FUNC_EN_N				(0x1 << 2) +#define CRC_FUNC_EN_N				(0x1 << 1) +#define SW_FUNC_EN_N				(0x1 << 0) + +/* DP FUNC_EN_2 */ +#define SSC_FUNC_EN_N			        (0x1 << 7) +#define AUX_FUNC_EN_N				(0x1 << 2) +#define SERDES_FIFO_FUNC_EN_N			(0x1 << 1) +#define LS_CLK_DOMAIN_FUNC_EN_N		        (0x1 << 0) + +/* EXYNOS_DP_PHY_PD */ +#define PHY_PD					(0x1 << 5) +#define AUX_PD					(0x1 << 4) +#define CH3_PD					(0x1 << 3) +#define CH2_PD					(0x1 << 2) +#define CH1_PD					(0x1 << 1) +#define CH0_PD					(0x1 << 0) + +/* EXYNOS_DP_COMMON_INT_STA_1 */ +#define VSYNC_DET				(0x1 << 7) +#define PLL_LOCK_CHG				(0x1 << 6) +#define SPDIF_ERR				(0x1 << 5) +#define SPDIF_UNSTBL				(0x1 << 4) +#define VID_FORMAT_CHG				(0x1 << 3) +#define AUD_CLK_CHG				(0x1 << 2) +#define VID_CLK_CHG				(0x1 << 1) +#define SW_INT					(0x1 << 0) + +/* EXYNOS_DP_DEBUG_CTL */ +#define PLL_LOCK				(0x1 << 4) +#define F_PLL_LOCK				(0x1 << 3) +#define PLL_LOCK_CTRL				(0x1 << 2) + +/* EXYNOS_DP_FUNC_EN_2 */ +#define SSC_FUNC_EN_N				(0x1 << 7) +#define AUX_FUNC_EN_N				(0x1 << 2) +#define SERDES_FIFO_FUNC_EN_N			(0x1 << 1) +#define LS_CLK_DOMAIN_FUNC_EN_N			(0x1 << 0) + +/* EXYNOS_DP_COMMON_INT_STA_4 */ +#define PSR_ACTIVE				(0x1 << 7) +#define PSR_INACTIVE				(0x1 << 6) +#define SPDIF_BI_PHASE_ERR			(0x1 << 5) +#define HOTPLUG_CHG				(0x1 << 2) +#define HPD_LOST				(0x1 << 1) +#define PLUG					(0x1 << 0) + +/* EXYNOS_DP_INT_STA */ +#define INT_HPD					(0x1 << 6) +#define HW_TRAINING_FINISH			(0x1 << 5) +#define RPLY_RECEIV				(0x1 << 1) +#define AUX_ERR					(0x1 << 0) + +/* EXYNOS_DP_SYS_CTL_3 */ +#define HPD_STATUS				(0x1 << 6) +#define F_HPD					(0x1 << 5) +#define HPD_CTRL				(0x1 << 4) +#define HDCP_RDY				(0x1 << 3) +#define STRM_VALID				(0x1 << 2) +#define F_VALID					(0x1 << 1) +#define VALID_CTRL				(0x1 << 0) + +/* EXYNOS_DP_AUX_HW_RETRY_CTL */ +#define AUX_BIT_PERIOD_EXPECTED_DELAY(x)	(((x) & 0x7) << 8) +#define AUX_HW_RETRY_INTERVAL_MASK		(0x3 << 3) +#define AUX_HW_RETRY_INTERVAL_600_MICROSECONDS	(0x0 << 3) +#define AUX_HW_RETRY_INTERVAL_800_MICROSECONDS	(0x1 << 3) +#define AUX_HW_RETRY_INTERVAL_1000_MICROSECONDS	(0x2 << 3) +#define AUX_HW_RETRY_INTERVAL_1800_MICROSECONDS	(0x3 << 3) +#define AUX_HW_RETRY_COUNT_SEL(x)		(((x) & 0x7) << 0) + +/* EXYNOS_DP_AUX_CH_DEFER_CTL */ +#define DEFER_CTRL_EN				(0x1 << 7) +#define DEFER_COUNT(x)				(((x) & 0x7f) << 0) + +#define COMMON_INT_MASK_1			(0) +#define COMMON_INT_MASK_2			(0) +#define COMMON_INT_MASK_3			(0) +#define COMMON_INT_MASK_4			(0) +#define INT_STA_MASK				(0) + +/* EXYNOS_DP_BUFFER_DATA_CTL */ +#define BUF_CLR					(0x1 << 7) +#define BUF_DATA_COUNT(x)			(((x) & 0x1f) << 0) + +/* EXYNOS_DP_AUX_ADDR_7_0 */ +#define AUX_ADDR_7_0(x)				(((x) >> 0) & 0xff) + +/* EXYNOS_DP_AUX_ADDR_15_8 */ +#define AUX_ADDR_15_8(x)			(((x) >> 8) & 0xff) + +/* EXYNOS_DP_AUX_ADDR_19_16 */ +#define AUX_ADDR_19_16(x)			(((x) >> 16) & 0x0f) + +/* EXYNOS_DP_AUX_CH_CTL_1 */ +#define AUX_LENGTH(x)				(((x - 1) & 0xf) << 4) +#define AUX_TX_COMM_MASK			(0xf << 0) +#define AUX_TX_COMM_DP_TRANSACTION		(0x1 << 3) +#define AUX_TX_COMM_I2C_TRANSACTION		(0x0 << 3) +#define AUX_TX_COMM_MOT				(0x1 << 2) +#define AUX_TX_COMM_WRITE			(0x0 << 0) +#define AUX_TX_COMM_READ			(0x1 << 0) + +/* EXYNOS_DP_AUX_CH_CTL_2 */ +#define ADDR_ONLY				(0x1 << 1) +#define AUX_EN					(0x1 << 0) + +/* EXYNOS_DP_AUX_CH_STA */ +#define AUX_BUSY				(0x1 << 4) +#define AUX_STATUS_MASK				(0xf << 0) + +/* EXYNOS_DP_AUX_RX_COMM */ +#define AUX_RX_COMM_I2C_DEFER			(0x2 << 2) +#define AUX_RX_COMM_AUX_DEFER			(0x2 << 0) + +/* EXYNOS_DP_PHY_TEST */ +#define MACRO_RST				(0x1 << 5) +#define CH1_TEST				(0x1 << 1) +#define CH0_TEST				(0x1 << 0) + +/* EXYNOS_DP_TRAINING_PTN_SET */ +#define SCRAMBLER_TYPE				(0x1 << 9) +#define HW_LINK_TRAINING_PATTERN		(0x1 << 8) +#define SCRAMBLING_DISABLE			(0x1 << 5) +#define SCRAMBLING_ENABLE			(0x0 << 5) +#define LINK_QUAL_PATTERN_SET_MASK		(0x3 << 2) +#define LINK_QUAL_PATTERN_SET_PRBS7		(0x3 << 2) +#define LINK_QUAL_PATTERN_SET_D10_2		(0x1 << 2) +#define LINK_QUAL_PATTERN_SET_DISABLE		(0x0 << 2) +#define SW_TRAINING_PATTERN_SET_MASK		(0x3 << 0) +#define SW_TRAINING_PATTERN_SET_PTN2		(0x2 << 0) +#define SW_TRAINING_PATTERN_SET_PTN1		(0x1 << 0) +#define SW_TRAINING_PATTERN_SET_NORMAL		(0x0 << 0) + +/* EXYNOS_DP_TOTAL_LINE_CFG */ +#define TOTAL_LINE_CFG_L(x)			((x) & 0xff) +#define TOTAL_LINE_CFG_H(x)			((((x) >> 8)) & 0xff) +#define ACTIVE_LINE_CFG_L(x)			((x) & 0xff) +#define ACTIVE_LINE_CFG_H(x)			(((x) >> 8) & 0xff) +#define TOTAL_PIXEL_CFG_L(x)			((x) & 0xff) +#define TOTAL_PIXEL_CFG_H(x)			((((x) >> 8)) & 0xff) +#define ACTIVE_PIXEL_CFG_L(x)			((x) & 0xff) +#define ACTIVE_PIXEL_CFG_H(x)			((((x) >> 8)) & 0xff) + +#define H_F_PORCH_CFG_L(x)			((x) & 0xff) +#define H_F_PORCH_CFG_H(x)			((((x) >> 8)) & 0xff) +#define H_SYNC_PORCH_CFG_L(x)			((x) & 0xff) +#define H_SYNC_PORCH_CFG_H(x)			((((x) >> 8)) & 0xff) +#define H_B_PORCH_CFG_L(x)			((x) & 0xff) +#define H_B_PORCH_CFG_H(x)			((((x) >> 8)) & 0xff) + +/* EXYNOS_DP_LN0_LINK_TRAINING_CTL */ +#define MAX_PRE_EMPHASIS_REACH_0		(0x1 << 5) +#define PRE_EMPHASIS_SET_0_SET(x)		(((x) & 0x3) << 3) +#define PRE_EMPHASIS_SET_0_GET(x)		(((x) >> 3) & 0x3) +#define PRE_EMPHASIS_SET_0_MASK			(0x3 << 3) +#define PRE_EMPHASIS_SET_0_SHIFT		(3) +#define PRE_EMPHASIS_SET_0_LEVEL_3		(0x3 << 3) +#define PRE_EMPHASIS_SET_0_LEVEL_2		(0x2 << 3) +#define PRE_EMPHASIS_SET_0_LEVEL_1		(0x1 << 3) +#define PRE_EMPHASIS_SET_0_LEVEL_0		(0x0 << 3) +#define MAX_DRIVE_CURRENT_REACH_0		(0x1 << 2) +#define DRIVE_CURRENT_SET_0_MASK		(0x3 << 0) +#define DRIVE_CURRENT_SET_0_SET(x)		(((x) & 0x3) << 0) +#define DRIVE_CURRENT_SET_0_GET(x)		(((x) >> 0) & 0x3) +#define DRIVE_CURRENT_SET_0_LEVEL_3		(0x3 << 0) +#define DRIVE_CURRENT_SET_0_LEVEL_2		(0x2 << 0) +#define DRIVE_CURRENT_SET_0_LEVEL_1		(0x1 << 0) +#define DRIVE_CURRENT_SET_0_LEVEL_0		(0x0 << 0) + +/* EXYNOS_DP_LN1_LINK_TRAINING_CTL */ +#define MAX_PRE_EMPHASIS_REACH_1		(0x1 << 5) +#define PRE_EMPHASIS_SET_1_SET(x)		(((x) & 0x3) << 3) +#define PRE_EMPHASIS_SET_1_GET(x)		(((x) >> 3) & 0x3) +#define PRE_EMPHASIS_SET_1_MASK			(0x3 << 3) +#define PRE_EMPHASIS_SET_1_SHIFT		(3) +#define PRE_EMPHASIS_SET_1_LEVEL_3		(0x3 << 3) +#define PRE_EMPHASIS_SET_1_LEVEL_2		(0x2 << 3) +#define PRE_EMPHASIS_SET_1_LEVEL_1		(0x1 << 3) +#define PRE_EMPHASIS_SET_1_LEVEL_0		(0x0 << 3) +#define MAX_DRIVE_CURRENT_REACH_1		(0x1 << 2) +#define DRIVE_CURRENT_SET_1_MASK		(0x3 << 0) +#define DRIVE_CURRENT_SET_1_SET(x)		(((x) & 0x3) << 0) +#define DRIVE_CURRENT_SET_1_GET(x)		(((x) >> 0) & 0x3) +#define DRIVE_CURRENT_SET_1_LEVEL_3		(0x3 << 0) +#define DRIVE_CURRENT_SET_1_LEVEL_2		(0x2 << 0) +#define DRIVE_CURRENT_SET_1_LEVEL_1		(0x1 << 0) +#define DRIVE_CURRENT_SET_1_LEVEL_0		(0x0 << 0) + +/* EXYNOS_DP_LN2_LINK_TRAINING_CTL */ +#define MAX_PRE_EMPHASIS_REACH_2		(0x1 << 5) +#define PRE_EMPHASIS_SET_2_SET(x)		(((x) & 0x3) << 3) +#define PRE_EMPHASIS_SET_2_GET(x)		(((x) >> 3) & 0x3) +#define PRE_EMPHASIS_SET_2_MASK			(0x3 << 3) +#define PRE_EMPHASIS_SET_2_SHIFT		(3) +#define PRE_EMPHASIS_SET_2_LEVEL_3		(0x3 << 3) +#define PRE_EMPHASIS_SET_2_LEVEL_2		(0x2 << 3) +#define PRE_EMPHASIS_SET_2_LEVEL_1		(0x1 << 3) +#define PRE_EMPHASIS_SET_2_LEVEL_0		(0x0 << 3) +#define MAX_DRIVE_CURRENT_REACH_2		(0x1 << 2) +#define DRIVE_CURRENT_SET_2_MASK		(0x3 << 0) +#define DRIVE_CURRENT_SET_2_SET(x)		(((x) & 0x3) << 0) +#define DRIVE_CURRENT_SET_2_GET(x)		(((x) >> 0) & 0x3) +#define DRIVE_CURRENT_SET_2_LEVEL_3		(0x3 << 0) +#define DRIVE_CURRENT_SET_2_LEVEL_2		(0x2 << 0) +#define DRIVE_CURRENT_SET_2_LEVEL_1		(0x1 << 0) +#define DRIVE_CURRENT_SET_2_LEVEL_0		(0x0 << 0) + +/* EXYNOS_DP_LN3_LINK_TRAINING_CTL */ +#define MAX_PRE_EMPHASIS_REACH_3		(0x1 << 5) +#define PRE_EMPHASIS_SET_3_SET(x)		(((x) & 0x3) << 3) +#define PRE_EMPHASIS_SET_3_GET(x)		(((x) >> 3) & 0x3) +#define PRE_EMPHASIS_SET_3_MASK			(0x3 << 3) +#define PRE_EMPHASIS_SET_3_SHIFT		(3) +#define PRE_EMPHASIS_SET_3_LEVEL_3		(0x3 << 3) +#define PRE_EMPHASIS_SET_3_LEVEL_2		(0x2 << 3) +#define PRE_EMPHASIS_SET_3_LEVEL_1		(0x1 << 3) +#define PRE_EMPHASIS_SET_3_LEVEL_0		(0x0 << 3) +#define MAX_DRIVE_CURRENT_REACH_3		(0x1 << 2) +#define DRIVE_CURRENT_SET_3_MASK		(0x3 << 0) +#define DRIVE_CURRENT_SET_3_SET(x)		(((x) & 0x3) << 0) +#define DRIVE_CURRENT_SET_3_GET(x)		(((x) >> 0) & 0x3) +#define DRIVE_CURRENT_SET_3_LEVEL_3		(0x3 << 0) +#define DRIVE_CURRENT_SET_3_LEVEL_2		(0x2 << 0) +#define DRIVE_CURRENT_SET_3_LEVEL_1		(0x1 << 0) +#define DRIVE_CURRENT_SET_3_LEVEL_0		(0x0 << 0) + +/* EXYNOS_DP_VIDEO_CTL_10 */ +#define FORMAT_SEL				(0x1 << 4) +#define INTERACE_SCAN_CFG			(0x1 << 2) +#define INTERACE_SCAN_CFG_SHIFT			(2) +#define VSYNC_POLARITY_CFG			(0x1 << 1) +#define V_S_POLARITY_CFG_SHIFT			(1) +#define HSYNC_POLARITY_CFG			(0x1 << 0) +#define H_S_POLARITY_CFG_SHIFT			(0) + +/* EXYNOS_DP_SOC_GENERAL_CTL */ +#define AUDIO_MODE_SPDIF_MODE			(0x1 << 8) +#define AUDIO_MODE_MASTER_MODE			(0x0 << 8) +#define MASTER_VIDEO_INTERLACE_EN		(0x1 << 4) +#define VIDEO_MASTER_CLK_SEL			(0x1 << 2) +#define VIDEO_MASTER_MODE_EN			(0x1 << 1) +#define VIDEO_MODE_MASK				(0x1 << 0) +#define VIDEO_MODE_SLAVE_MODE			(0x1 << 0) +#define VIDEO_MODE_MASTER_MODE			(0x0 << 0) + +/* EXYNOS_DP_VIDEO_CTL_1 */ +#define VIDEO_EN				(0x1 << 7) +#define HDCP_VIDEO_MUTE				(0x1 << 6) + +/* EXYNOS_DP_VIDEO_CTL_2 */ +#define IN_D_RANGE_MASK				(0x1 << 7) +#define IN_D_RANGE_SHIFT			(7) +#define IN_D_RANGE_CEA				(0x1 << 7) +#define IN_D_RANGE_VESA				(0x0 << 7) +#define IN_BPC_MASK				(0x7 << 4) +#define IN_BPC_SHIFT				(4) +#define IN_BPC_12_BITS				(0x3 << 4) +#define IN_BPC_10_BITS				(0x2 << 4) +#define IN_BPC_8_BITS				(0x1 << 4) +#define IN_BPC_6_BITS				(0x0 << 4) +#define IN_COLOR_F_MASK				(0x3 << 0) +#define IN_COLOR_F_SHIFT			(0) +#define IN_COLOR_F_YCBCR444			(0x2 << 0) +#define IN_COLOR_F_YCBCR422			(0x1 << 0) +#define IN_COLOR_F_RGB				(0x0 << 0) + +/* EXYNOS_DP_VIDEO_CTL_3 */ +#define IN_YC_COEFFI_MASK			(0x1 << 7) +#define IN_YC_COEFFI_SHIFT			(7) +#define IN_YC_COEFFI_ITU709			(0x1 << 7) +#define IN_YC_COEFFI_ITU601			(0x0 << 7) +#define VID_CHK_UPDATE_TYPE_MASK		(0x1 << 4) +#define VID_CHK_UPDATE_TYPE_SHIFT		(4) +#define VID_CHK_UPDATE_TYPE_1			(0x1 << 4) +#define VID_CHK_UPDATE_TYPE_0			(0x0 << 4) + +/* EXYNOS_DP_TEST_PATTERN_GEN_EN */ +#define TEST_PATTERN_GEN_EN			(0x1 << 0) +#define TEST_PATTERN_GEN_DIS			(0x0 << 0) + +/* EXYNOS_DP_TEST_PATTERN_GEN_CTRL */ +#define TEST_PATTERN_MODE_COLOR_SQUARE		(0x3 << 0) +#define TEST_PATTERN_MODE_BALCK_WHITE_V_LINES	(0x2 << 0) +#define TEST_PATTERN_MODE_COLOR_RAMP		(0x1 << 0) + +/* EXYNOS_DP_VIDEO_CTL_4 */ +#define BIST_EN					(0x1 << 3) +#define BIST_WIDTH_MASK				(0x1 << 2) +#define BIST_WIDTH_BAR_32_PIXEL			(0x0 << 2) +#define BIST_WIDTH_BAR_64_PIXEL			(0x1 << 2) +#define BIST_TYPE_MASK				(0x3 << 0) +#define BIST_TYPE_COLOR_BAR			(0x0 << 0) +#define BIST_TYPE_WHITE_GRAY_BLACK_BAR		(0x1 << 0) +#define BIST_TYPE_MOBILE_WHITE_BAR		(0x2 << 0) + +/* EXYNOS_DP_SYS_CTL_1 */ +#define DET_STA					(0x1 << 2) +#define FORCE_DET				(0x1 << 1) +#define DET_CTRL				(0x1 << 0) + +/* EXYNOS_DP_SYS_CTL_2 */ +#define CHA_CRI(x)				(((x) & 0xf) << 4) +#define CHA_STA					(0x1 << 2) +#define FORCE_CHA				(0x1 << 1) +#define CHA_CTRL				(0x1 << 0) + +/* EXYNOS_DP_SYS_CTL_3 */ +#define HPD_STATUS				(0x1 << 6) +#define F_HPD					(0x1 << 5) +#define HPD_CTRL				(0x1 << 4) +#define HDCP_RDY				(0x1 << 3) +#define STRM_VALID				(0x1 << 2) +#define F_VALID					(0x1 << 1) +#define VALID_CTRL				(0x1 << 0) + +/* EXYNOS_DP_SYS_CTL_4 */ +#define FIX_M_AUD				(0x1 << 4) +#define ENHANCED				(0x1 << 3) +#define FIX_M_VID				(0x1 << 2) +#define M_VID_UPDATE_CTRL			(0x3 << 0) + +/* EXYNOS_M_VID_X */ +#define M_VID0_CFG(x)				((x) & 0xff) +#define M_VID1_CFG(x)				(((x) >> 8) & 0xff) +#define M_VID2_CFG(x)				(((x) >> 16) & 0xff) + +/* EXYNOS_M_VID_X */ +#define N_VID0_CFG(x)				((x) & 0xff) +#define N_VID1_CFG(x)				(((x) >> 8) & 0xff) +#define N_VID2_CFG(x)				(((x) >> 16) & 0xff) + +/* DPCD_TRAINING_PATTERN_SET */ +#define DPCD_SCRAMBLING_DISABLED		(0x1 << 5) +#define DPCD_SCRAMBLING_ENABLED			(0x0 << 5) +#define DPCD_TRAINING_PATTERN_2			(0x2 << 0) +#define DPCD_TRAINING_PATTERN_1			(0x1 << 0) +#define DPCD_TRAINING_PATTERN_DISABLED		(0x0 << 0) + +/* Definition for DPCD Register */ +#define DPCD_DPCD_REV				(0x0000) +#define DPCD_MAX_LINK_RATE			(0x0001) +#define DPCD_MAX_LANE_COUNT			(0x0002) +#define DPCD_LINK_BW_SET			(0x0100) +#define DPCD_LANE_COUNT_SET			(0x0101) +#define DPCD_TRAINING_PATTERN_SET		(0x0102) +#define DPCD_TRAINING_LANE0_SET			(0x0103) +#define DPCD_LANE0_1_STATUS			(0x0202) +#define DPCD_LN_ALIGN_UPDATED			(0x0204) +#define DPCD_ADJUST_REQUEST_LANE0_1		(0x0206) +#define DPCD_ADJUST_REQUEST_LANE2_3		(0x0207) +#define DPCD_TEST_REQUEST			(0x0218) +#define DPCD_TEST_RESPONSE			(0x0260) +#define DPCD_TEST_EDID_CHECKSUM			(0x0261) +#define DPCD_SINK_POWER_STATE			(0x0600) + +/* DPCD_TEST_REQUEST */ +#define DPCD_TEST_EDID_READ			(0x1 << 2) + +/* DPCD_TEST_RESPONSE */ +#define DPCD_TEST_EDID_CHECKSUM_WRITE		(0x1 << 2) + +/* DPCD_SINK_POWER_STATE */ +#define DPCD_SET_POWER_STATE_D0			(0x1 << 0) +#define DPCD_SET_POWER_STATE_D4			(0x2 << 0) + +/* I2C EDID Chip ID, Slave Address */ +#define I2C_EDID_DEVICE_ADDR			(0x50) +#define I2C_E_EDID_DEVICE_ADDR			(0x30) +#define EDID_BLOCK_LENGTH			(0x80) +#define EDID_HEADER_PATTERN			(0x00) +#define EDID_EXTENSION_FLAG			(0x7e) +#define EDID_CHECKSUM				(0x7f) + +/* DPCD_LANE0_1_STATUS */ +#define DPCD_LANE1_SYMBOL_LOCKED		(0x1 << 6) +#define DPCD_LANE1_CHANNEL_EQ_DONE		(0x1 << 5) +#define DPCD_LANE1_CR_DONE			(0x1 << 4) +#define DPCD_LANE0_SYMBOL_LOCKED		(0x1 << 2) +#define DPCD_LANE0_CHANNEL_EQ_DONE		(0x1 << 1) +#define DPCD_LANE0_CR_DONE			(0x1 << 0) + +/* DPCD_ADJUST_REQUEST_LANE0_1 */ +#define DPCD_PRE_EMPHASIS_LANE1_MASK		(0x3 << 6) +#define DPCD_PRE_EMPHASIS_LANE1(x)		(((x) >> 6) & 0x3) +#define DPCD_PRE_EMPHASIS_LANE1_LEVEL_3		(0x3 << 6) +#define DPCD_PRE_EMPHASIS_LANE1_LEVEL_2		(0x2 << 6) +#define DPCD_PRE_EMPHASIS_LANE1_LEVEL_1		(0x1 << 6) +#define DPCD_PRE_EMPHASIS_LANE1_LEVEL_0		(0x0 << 6) +#define DPCD_VOLTAGE_SWING_LANE1_MASK		(0x3 << 4) +#define DPCD_VOLTAGE_SWING_LANE1(x)		(((x) >> 4) & 0x3) +#define DPCD_VOLTAGE_SWING_LANE1_LEVEL_3	(0x3 << 4) +#define DPCD_VOLTAGE_SWING_LANE1_LEVEL_2	(0x2 << 4) +#define DPCD_VOLTAGE_SWING_LANE1_LEVEL_1	(0x1 << 4) +#define DPCD_VOLTAGE_SWING_LANE1_LEVEL_0	(0x0 << 4) +#define DPCD_PRE_EMPHASIS_LANE0_MASK		(0x3 << 2) +#define DPCD_PRE_EMPHASIS_LANE0(x)		(((x) >> 2) & 0x3) +#define DPCD_PRE_EMPHASIS_LANE0_LEVEL_3		(0x3 << 2) +#define DPCD_PRE_EMPHASIS_LANE0_LEVEL_2		(0x2 << 2) +#define DPCD_PRE_EMPHASIS_LANE0_LEVEL_1		(0x1 << 2) +#define DPCD_PRE_EMPHASIS_LANE0_LEVEL_0		(0x0 << 2) +#define DPCD_VOLTAGE_SWING_LANE0_MASK		(0x3 << 0) +#define DPCD_VOLTAGE_SWING_LANE0(x)		(((x) >> 0) & 0x3) +#define DPCD_VOLTAGE_SWING_LANE0_LEVEL_3	(0x3 << 0) +#define DPCD_VOLTAGE_SWING_LANE0_LEVEL_2	(0x2 << 0) +#define DPCD_VOLTAGE_SWING_LANE0_LEVEL_1	(0x1 << 0) +#define DPCD_VOLTAGE_SWING_LANE0_LEVEL_0	(0x0 << 0) + +/* DPCD_ADJUST_REQUEST_LANE2_3 */ +#define DPCD_PRE_EMPHASIS_LANE2_MASK		(0x3 << 6) +#define DPCD_PRE_EMPHASIS_LANE2(x)		(((x) >> 6) & 0x3) +#define DPCD_PRE_EMPHASIS_LANE2_LEVEL_3		(0x3 << 6) +#define DPCD_PRE_EMPHASIS_LANE2_LEVEL_2		(0x2 << 6) +#define DPCD_PRE_EMPHASIS_LANE2_LEVEL_1		(0x1 << 6) +#define DPCD_PRE_EMPHASIS_LANE2_LEVEL_0		(0x0 << 6) +#define DPCD_VOLTAGE_SWING_LANE2_MASK		(0x3 << 4) +#define DPCD_VOLTAGE_SWING_LANE2(x)		(((x) >> 4) & 0x3) +#define DPCD_VOLTAGE_SWING_LANE2_LEVEL_3	(0x3 << 4) +#define DPCD_VOLTAGE_SWING_LANE2_LEVEL_2	(0x2 << 4) +#define DPCD_VOLTAGE_SWING_LANE2_LEVEL_1	(0x1 << 4) +#define DPCD_VOLTAGE_SWING_LANE2_LEVEL_0	(0x0 << 4) +#define DPCD_PRE_EMPHASIS_LANE3_MASK		(0x3 << 2) +#define DPCD_PRE_EMPHASIS_LANE3(x)		(((x) >> 2) & 0x3) +#define DPCD_PRE_EMPHASIS_LANE3_LEVEL_3		(0x3 << 2) +#define DPCD_PRE_EMPHASIS_LANE3_LEVEL_2		(0x2 << 2) +#define DPCD_PRE_EMPHASIS_LANE3_LEVEL_1		(0x1 << 2) +#define DPCD_PRE_EMPHASIS_LANE3_LEVEL_0		(0x0 << 2) +#define DPCD_VOLTAGE_SWING_LANE3_MASK		(0x3 << 0) +#define DPCD_VOLTAGE_SWING_LANE3(x)		(((x) >> 0) & 0x3) +#define DPCD_VOLTAGE_SWING_LANE3_LEVEL_3	(0x3 << 0) +#define DPCD_VOLTAGE_SWING_LANE3_LEVEL_2	(0x2 << 0) +#define DPCD_VOLTAGE_SWING_LANE3_LEVEL_1	(0x1 << 0) +#define DPCD_VOLTAGE_SWING_LANE3_LEVEL_0	(0x0 << 0) + +/* DPCD_LANE_COUNT_SET */ +#define DPCD_ENHANCED_FRAME_EN			(0x1 << 7) +#define DPCD_LN_COUNT_SET(x)			((x) & 0x1f) + +/* DPCD_LANE_ALIGN__STATUS_UPDATED */ +#define DPCD_LINK_STATUS_UPDATED		(0x1 << 7) +#define DPCD_DOWNSTREAM_PORT_STATUS_CHANGED	(0x1 << 6) +#define DPCD_INTERLANE_ALIGN_DONE		(0x1 << 0) + +/* DPCD_TRAINING_LANE0_SET */ +#define DPCD_PRE_EMPHASIS_SET_PATTERN_2_LEVEL_3		(0x3 << 3) +#define DPCD_PRE_EMPHASIS_SET_PATTERN_2_LEVEL_2		(0x2 << 3) +#define DPCD_PRE_EMPHASIS_SET_PATTERN_2_LEVEL_1		(0x1 << 3) +#define DPCD_PRE_EMPHASIS_SET_PATTERN_2_LEVEL_0		(0x0 << 3) +#define DPCD_VOLTAGE_SWING_SET_PATTERN_1_LEVEL_3	(0x3 << 0) +#define DPCD_VOLTAGE_SWING_SET_PATTERN_1_LEVEL_2	(0x2 << 0) +#define DPCD_VOLTAGE_SWING_SET_PATTERN_1_LEVEL_1	(0x1 << 0) +#define DPCD_VOLTAGE_SWING_SET_PATTERN_1_LEVEL_0	(0x0 << 0) + +#define DPCD_REQ_ADJ_SWING			(0x00) +#define DPCD_REQ_ADJ_EMPHASIS			(0x01) + +#define DP_LANE_STAT_CR_DONE			(0x01 << 0) +#define DP_LANE_STAT_CE_DONE			(0x01 << 1) +#define DP_LANE_STAT_SYM_LOCK			(0x01 << 2) + +#endif diff --git a/arch/arm/include/asm/arch-exynos/dp_info.h b/arch/arm/include/asm/arch-exynos/dp_info.h new file mode 100644 index 000000000..35694980f --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/dp_info.h @@ -0,0 +1,214 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * Author: Donghwa Lee <dh09.lee@samsung.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 + */ + +#ifndef _DP_INFO_H +#define _DP_INFO_H + +#define msleep(a)			udelay(a * 1000) + +#define DP_TIMEOUT_LOOP_COUNT		100 +#define MAX_CR_LOOP			5 +#define MAX_EQ_LOOP			4 + +#define EXYNOS_DP_SUCCESS		0 + +enum { +	DP_DISABLE, +	DP_ENABLE, +}; + +struct edp_disp_info { +	char *name; +	unsigned int h_total; +	unsigned int h_res; +	unsigned int h_sync_width; +	unsigned int h_back_porch; +	unsigned int h_front_porch; +	unsigned int v_total; +	unsigned int v_res; +	unsigned int v_sync_width; +	unsigned int v_back_porch; +	unsigned int v_front_porch; + +	unsigned int v_sync_rate; +}; + +struct edp_link_train_info { +	unsigned int lt_status; + +	unsigned int ep_loop; +	unsigned int cr_loop[4]; + +}; + +struct edp_video_info { +	unsigned int master_mode; +	unsigned int bist_mode; +	unsigned int bist_pattern; + +	unsigned int h_sync_polarity; +	unsigned int v_sync_polarity; +	unsigned int interlaced; + +	unsigned int color_space; +	unsigned int dynamic_range; +	unsigned int ycbcr_coeff; +	unsigned int color_depth; +}; + +struct edp_device_info { +	struct edp_disp_info disp_info; +	struct edp_link_train_info lt_info; +	struct edp_video_info video_info; + +	/*below info get from panel during training*/ +	unsigned char lane_bw; +	unsigned char lane_cnt; +	unsigned char dpcd_rev; +	/*support enhanced frame cap */ +	unsigned char dpcd_efc; +}; + +enum analog_power_block { +	AUX_BLOCK, +	CH0_BLOCK, +	CH1_BLOCK, +	CH2_BLOCK, +	CH3_BLOCK, +	ANALOG_TOTAL, +	POWER_ALL +}; + +enum pll_status { +	PLL_UNLOCKED = 0, +	PLL_LOCKED +}; + +enum { +	COLOR_RGB, +	COLOR_YCBCR422, +	COLOR_YCBCR444 +}; + +enum { +	VESA, +	CEA +}; + +enum { +	COLOR_YCBCR601, +	COLOR_YCBCR709 +}; + +enum { +	COLOR_6, +	COLOR_8, +	COLOR_10, +	COLOR_12 +}; + +enum { +	DP_LANE_BW_1_62 = 0x06, +	DP_LANE_BW_2_70 = 0x0a, +}; + +enum { +	DP_LANE_CNT_1 = 1, +	DP_LANE_CNT_2 = 2, +	DP_LANE_CNT_4 = 4, +}; + +enum { +	DP_DPCD_REV_10 = 0x10, +	DP_DPCD_REV_11 = 0x11, +}; + +enum { +	DP_LT_NONE, +	DP_LT_START, +	DP_LT_CR, +	DP_LT_ET, +	DP_LT_FINISHED, +	DP_LT_FAIL, +}; + +enum  { +	PRE_EMPHASIS_LEVEL_0, +	PRE_EMPHASIS_LEVEL_1, +	PRE_EMPHASIS_LEVEL_2, +	PRE_EMPHASIS_LEVEL_3, +}; + +enum { +	PRBS7, +	D10_2, +	TRAINING_PTN1, +	TRAINING_PTN2, +	DP_NONE +}; + +enum { +	VOLTAGE_LEVEL_0, +	VOLTAGE_LEVEL_1, +	VOLTAGE_LEVEL_2, +	VOLTAGE_LEVEL_3, +}; + +enum pattern_type { +	NO_PATTERN, +	COLOR_RAMP, +	BALCK_WHITE_V_LINES, +	COLOR_SQUARE, +	INVALID_PATTERN, +	COLORBAR_32, +	COLORBAR_64, +	WHITE_GRAY_BALCKBAR_32, +	WHITE_GRAY_BALCKBAR_64, +	MOBILE_WHITEBAR_32, +	MOBILE_WHITEBAR_64 +}; + +enum { +	CALCULATED_M, +	REGISTER_M +}; + +enum { +	VIDEO_TIMING_FROM_CAPTURE, +	VIDEO_TIMING_FROM_REGISTER +}; + + +struct exynos_dp_platform_data { +	struct edp_device_info *edp_dev_info; +	void (*phy_enable)(unsigned int); +}; + +#ifdef CONFIG_EXYNOS_DP +unsigned int exynos_init_dp(void); +#else +unsigned int exynos_init_dp(void) +{ +	return 0; +} +#endif + +#endif /* _DP_INFO_H */ diff --git a/arch/arm/include/asm/arch-exynos/fb.h b/arch/arm/include/asm/arch-exynos/fb.h index b10b0da07..01445afde 100644 --- a/arch/arm/include/asm/arch-exynos/fb.h +++ b/arch/arm/include/asm/arch-exynos/fb.h @@ -23,7 +23,7 @@  #define __ASM_ARM_ARCH_FB_H_  #ifndef __ASSEMBLY__ -struct exynos4_fb { +struct exynos_fb {  	unsigned int vidcon0;  	unsigned int vidcon1;  	unsigned int vidcon2; @@ -151,9 +151,23 @@ struct exynos4_fb {  	unsigned char res15[156];  	unsigned int dualrgb; +	unsigned char res16[16]; +	unsigned int dp_mie_clkcon;  };  #endif +/* LCD IF register offset */ +#define EXYNOS4_LCD_IF_BASE_OFFSET			0x0 +#define EXYNOS5_LCD_IF_BASE_OFFSET			0x20000 + +static inline unsigned int exynos_fimd_get_base_offset(void) +{ +	if (cpu_is_exynos5()) +		return EXYNOS5_LCD_IF_BASE_OFFSET; +	else +		return EXYNOS4_LCD_IF_BASE_OFFSET; +} +  /*   *  Register offsets  */ @@ -253,6 +267,8 @@ struct exynos4_fb {  /* VIDTCON2 */  #define EXYNOS_VIDTCON2_LINEVAL(x)			(((x) & 0x7ff) << 11)  #define EXYNOS_VIDTCON2_HOZVAL(x)			(((x) & 0x7ff) << 0) +#define EXYNOS_VIDTCON2_LINEVAL_E(x)			((((x) & 0x800) >> 11) << 23) +#define EXYNOS_VIDTCON2_HOZVAL_E(x)			((((x) & 0x800) >> 11) << 22)  /* Window 0~4 Control - WINCONx */  #define EXYNOS_WINCON_DATAPATH_DMA			(0 << 22) @@ -330,6 +346,8 @@ struct exynos4_fb {  #define EXYNOS_VIDOSD_TOP_Y(x)				(((x) & 0x7ff) << 0)  #define EXYNOS_VIDOSD_RIGHT_X(x)			(((x) & 0x7ff) << 11)  #define EXYNOS_VIDOSD_BOTTOM_Y(x)			(((x) & 0x7ff) << 0) +#define EXYNOS_VIDOSD_RIGHT_X_E(x)			(((x) & 0x1) << 23) +#define EXYNOS_VIDOSD_BOTTOM_Y_E(x)			(((x) & 0x1) << 22)  /* VIDOSD0C, VIDOSDxD */  #define EXYNOS_VIDOSD_SIZE(x)				(((x) & 0xffffff) << 0) @@ -354,6 +372,8 @@ struct exynos4_fb {  /* Buffer Size */  #define EXYNOS_VIDADDR_OFFSIZE(x)			(((x) & 0x1fff) << 13)  #define EXYNOS_VIDADDR_PAGEWIDTH(x)			(((x) & 0x1fff) << 0) +#define EXYNOS_VIDADDR_OFFSIZE_E(x)			((((x) & 0x2000) >> 13) << 27) +#define EXYNOS_VIDADDR_PAGEWIDTH_E(x)			((((x) & 0x2000) >> 13) << 26)  /* WIN Color Map */  #define EXYNOS_WINMAP_COLOR(x)				((x) & 0xffffff) @@ -443,4 +463,9 @@ struct exynos4_fb {  #define EXYNOS_I80START_TRIG				(1 << 1)  #define EXYNOS_I80STATUS_TRIG_DONE			(1 << 2) +/* DP_MIE_CLKCON */ +#define EXYNOS_DP_MIE_DISABLE				(0 << 0) +#define EXYNOS_DP_CLK_ENABLE				(1 << 1) +#define EXYNOS_MIE_CLK_ENABLE				(3 << 0) +  #endif /* _REGS_FB_H */ diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h index 7a9bb90a0..97be4eac0 100644 --- a/arch/arm/include/asm/arch-exynos/gpio.h +++ b/arch/arm/include/asm/arch-exynos/gpio.h @@ -100,7 +100,9 @@ struct exynos5_gpio_part1 {  	struct s5p_gpio_bank y4;  	struct s5p_gpio_bank y5;  	struct s5p_gpio_bank y6; -	struct s5p_gpio_bank res1[0x980]; +	struct s5p_gpio_bank res1[0x3]; +	struct s5p_gpio_bank c4; +	struct s5p_gpio_bank res2[0x48];  	struct s5p_gpio_bank x0;  	struct s5p_gpio_bank x1;  	struct s5p_gpio_bank x2; @@ -122,9 +124,10 @@ struct exynos5_gpio_part2 {  struct exynos5_gpio_part3 {  	struct s5p_gpio_bank v0;  	struct s5p_gpio_bank v1; +	struct s5p_gpio_bank res1[0x1];  	struct s5p_gpio_bank v2;  	struct s5p_gpio_bank v3; -	struct s5p_gpio_bank res1[0x20]; +	struct s5p_gpio_bank res2[0x1];  	struct s5p_gpio_bank v4;  }; diff --git a/arch/arm/include/asm/arch-exynos/mmc.h b/arch/arm/include/asm/arch-exynos/mmc.h index 0f701c901..afdfcf049 100644 --- a/arch/arm/include/asm/arch-exynos/mmc.h +++ b/arch/arm/include/asm/arch-exynos/mmc.h @@ -64,11 +64,11 @@  #define SDHCI_CTRL4_DRIVE_MASK(_x)	((_x) << 16)  #define SDHCI_CTRL4_DRIVE_SHIFT		(16) -int s5p_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks); +int s5p_sdhci_init(u32 regbase, int index, int bus_width);  static inline unsigned int s5p_mmc_init(int index, int bus_width)  {  	unsigned int base = samsung_get_base_mmc() + (0x10000 * index); -	return s5p_sdhci_init(base, 52000000, 400000, index); +	return s5p_sdhci_init(base, index, bus_width);  }  #endif diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h index e5467e242..d2fdb5981 100644 --- a/arch/arm/include/asm/arch-exynos/power.h +++ b/arch/arm/include/asm/arch-exynos/power.h @@ -859,4 +859,9 @@ void set_usbhost_phy_ctrl(unsigned int enable);  #define POWER_USB_HOST_PHY_CTRL_EN		(1 << 0)  #define POWER_USB_HOST_PHY_CTRL_DISABLE		(0 << 0) + +void set_dp_phy_ctrl(unsigned int enable); + +#define EXYNOS_DP_PHY_ENABLE		(1 << 0) +  #endif diff --git a/arch/arm/include/asm/arch-exynos/pwm_backlight.h b/arch/arm/include/asm/arch-exynos/pwm_backlight.h new file mode 100644 index 000000000..368ffc5cd --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/pwm_backlight.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * Author: Donghwa Lee <dh09.lee@samsung.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 + */ + +#ifndef _PWM_BACKLIGHT_H_ +#define _PWM_BACKLIGHT_H_ + +struct pwm_backlight_data { +	int pwm_id; +	int period; +	int max_brightness; +	int brightness; +}; + +extern int exynos_pwm_backlight_init(struct pwm_backlight_data *pd); + +#endif /* _PWM_BACKLIGHT_H_ */ diff --git a/arch/arm/include/asm/arch-exynos/spl.h b/arch/arm/include/asm/arch-exynos/spl.h new file mode 100644 index 000000000..306b41d82 --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/spl.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2012 The Chromium OS Authors. + * + * 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 + */ + +#ifndef __ASM_ARCH_EXYNOS_SPL_H__ +#define __ASM_ARCH_EXYNOS_SPL_H__ + +#include <asm/arch-exynos/dmc.h> + +enum boot_mode { +	/* +	 * Assign the OM pin values for respective boot modes. +	 * Exynos4 does not support spi boot and the mmc boot OM +	 * pin values are the same across Exynos4 and Exynos5. +	 */ +	BOOT_MODE_MMC = 4, +	BOOT_MODE_SERIAL = 20, +	/* Boot based on Operating Mode pin settings */ +	BOOT_MODE_OM = 32, +	BOOT_MODE_USB,	/* Boot using USB download */ +}; + +#ifndef __ASSEMBLY__ +/* Parameters of early board initialization in SPL */ +struct spl_machine_param { +	/* Add fields as and when required */ +	u32		signature; +	u32		version;	/* Version number */ +	u32		size;		/* Size of block */ +	/** +	 * Parameters we expect, in order, terminated with \0. Each parameter +	 * is a single character representing one 32-bit word in this +	 * structure. +	 * +	 * Valid characters in this string are: +	 * +	 * Code		Name +	 * v		mem_iv_size +	 * m		mem_type +	 * u		uboot_size +	 * b		boot_source +	 * f		frequency_mhz (memory frequency in MHz) +	 * a		ARM clock frequency in MHz +	 * s		serial base address +	 * i		i2c base address for early access (meant for PMIC) +	 * r		board rev GPIO numbers used to read board revision +	 *			(lower halfword=bit 0, upper=bit 1) +	 * M		Memory Manufacturer name +	 * \0		termination +	 */ +	char		params[12];	/* Length must be word-aligned */ +	u32		mem_iv_size;	/* Memory channel interleaving size */ +	enum ddr_mode	mem_type;	/* Type of on-board memory */ +	/* +	 * U-boot size - The iROM mmc copy function used by the SPL takes a +	 * block count paramter to describe the u-boot size unlike the spi +	 * boot copy function which just uses the u-boot size directly. Align +	 * the u-boot size to block size (512 bytes) when populating the SPL +	 * table only for mmc boot. +	 */ +	u32		uboot_size; +	enum boot_mode	boot_source;	/* Boot device */ +	enum mem_manuf	mem_manuf;	/* Memory Manufacturer */ +	unsigned	frequency_mhz;	/* Frequency of memory in MHz */ +	unsigned	arm_freq_mhz;	/* ARM Frequency in MHz */ +	u32		serial_base;	/* Serial base address */ +	u32		i2c_base;	/* i2c base address */ +} __attribute__((__packed__)); +#endif + +/** + * Validate signature and return a pointer to the parameter table.  If the + * signature is invalid, call panic() and never return. + * + * @return pointer to the parameter table if signature matched or never return. + */ +struct spl_machine_param *spl_get_machine_params(void); + +#endif /* __ASM_ARCH_EXYNOS_SPL_H__ */ diff --git a/arch/arm/include/asm/arch-imx/imx-regs.h b/arch/arm/include/asm/arch-imx/imx-regs.h index ec94ba913..4de0779d2 100644 --- a/arch/arm/include/asm/arch-imx/imx-regs.h +++ b/arch/arm/include/asm/arch-imx/imx-regs.h @@ -1,5 +1,8 @@  #ifndef _IMX_REGS_H  #define _IMX_REGS_H + +#define ARCH_MXC +  /* ------------------------------------------------------------------------   *  Motorola IMX system registers   * ------------------------------------------------------------------------ diff --git a/arch/arm/include/asm/arch-kirkwood/spi.h b/arch/arm/include/asm/arch-kirkwood/spi.h index c79bed7ed..113f25875 100644 --- a/arch/arm/include/asm/arch-kirkwood/spi.h +++ b/arch/arm/include/asm/arch-kirkwood/spi.h @@ -49,6 +49,7 @@ struct kwspi_registers {  #define MISO_MPP11	(1 << 2)  #define KWSPI_CLKPRESCL_MASK	0x1f +#define KWSPI_CLKPRESCL_MIN	0x12  #define KWSPI_CSN_ACT		1 /* Activates serial memory interface */  #define KWSPI_SMEMRDY		(1 << 1) /* SerMem Data xfer ready */  #define KWSPI_IRQUNMASK		1 /* unmask SPI interrupt */ diff --git a/arch/arm/include/asm/arch-mx25/clock.h b/arch/arm/include/asm/arch-mx25/clock.h index 0f47eaf05..a313b8061 100644 --- a/arch/arm/include/asm/arch-mx25/clock.h +++ b/arch/arm/include/asm/arch-mx25/clock.h @@ -26,6 +26,20 @@  #ifndef __ASM_ARCH_CLOCK_H  #define __ASM_ARCH_CLOCK_H +#include <common.h> + +#ifdef CONFIG_MX25_HCLK_FREQ +#define MXC_HCLK	CONFIG_MX25_HCLK_FREQ +#else +#define MXC_HCLK	24000000 +#endif + +#ifdef CONFIG_MX25_CLK32 +#define MXC_CLK32	CONFIG_MX25_CLK32 +#else +#define MXC_CLK32	32768 +#endif +  enum mxc_clock {  	MXC_CSI_CLK,  	MXC_EPIT_CLK, diff --git a/arch/arm/include/asm/arch-mx25/gpio.h b/arch/arm/include/asm/arch-mx25/gpio.h index dc6edc7c8..61c0b0d72 100644 --- a/arch/arm/include/asm/arch-mx25/gpio.h +++ b/arch/arm/include/asm/arch-mx25/gpio.h @@ -25,21 +25,6 @@  #ifndef __ASM_ARCH_MX25_GPIO_H  #define __ASM_ARCH_MX25_GPIO_H -/* Converts a GPIO port number and the internal bit position - * to the GPIO number - */ -#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit & 0x1f)) - -/* GPIO registers */ -struct gpio_regs { -	u32 gpio_dr;	/* data */ -	u32 gpio_dir;	/* direction */ -	u32 psr;	/* pad satus */ -	u32 icr1;	/* interrupt config 1 */ -	u32 icr2;	/* interrupt config 2 */ -	u32 imr;	/* interrupt mask */ -	u32 isr;	/* interrupt status */ -	u32 edge_sel;	/* edge select */ -}; +#include <asm/imx-common/gpio.h>  #endif diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h b/arch/arm/include/asm/arch-mx25/imx-regs.h index cf925d70d..672f9d74b 100644 --- a/arch/arm/include/asm/arch-mx25/imx-regs.h +++ b/arch/arm/include/asm/arch-mx25/imx-regs.h @@ -172,6 +172,8 @@ struct aips_regs {  #endif +#define ARCH_MXC +  /* AIPS 1 */  #define IMX_AIPS1_BASE		(0x43F00000)  #define IMX_MAX_BASE		(0x43F04000) diff --git a/arch/arm/include/asm/arch-mx27/gpio.h b/arch/arm/include/asm/arch-mx27/gpio.h new file mode 100644 index 000000000..4b4eb0d5c --- /dev/null +++ b/arch/arm/include/asm/arch-mx27/gpio.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 + * Philippe Reynes <tremyfr@yahoo.fr> + * + * 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 + */ + + +#ifndef __ASM_ARCH_MX27_GPIO_H +#define __ASM_ARCH_MX27_GPIO_H + +/* GPIO registers */ +struct gpio_regs { +	u32 gpio_dir; /* DDIR */ +	u32 ocr1; +	u32 ocr2; +	u32 iconfa1; +	u32 iconfa2; +	u32 iconfb1; +	u32 iconfb2; +	u32 gpio_dr; /* DR */ +	u32 gius; +	u32 gpio_psr; /* SSR */ +	u32 icr1; +	u32 icr2; +	u32 imr; +	u32 isr; +	u32 gpr; +	u32 swr; +	u32 puen; +	u32 res[0x2f]; +}; + +/* This structure is used by the function imx_gpio_mode */ +struct gpio_port_regs { +	struct gpio_regs port[6]; +}; + +#endif diff --git a/arch/arm/include/asm/arch-mx27/imx-regs.h b/arch/arm/include/asm/arch-mx27/imx-regs.h index ced5b2a38..2f6c82372 100644 --- a/arch/arm/include/asm/arch-mx27/imx-regs.h +++ b/arch/arm/include/asm/arch-mx27/imx-regs.h @@ -24,6 +24,8 @@  #ifndef _IMX_REGS_H  #define _IMX_REGS_H +#include <asm/arch/regs-rtc.h> +  #ifndef __ASSEMBLY__  extern void imx_gpio_mode (int gpio_mode); @@ -162,29 +164,6 @@ struct gpt_regs {  #define PORTE 4  #define PORTF 5 -struct gpio_regs { -	struct { -		u32 ddir; -		u32 ocr1; -		u32 ocr2; -		u32 iconfa1; -		u32 iconfa2; -		u32 iconfb1; -		u32 iconfb2; -		u32 dr; -		u32 gius; -		u32 ssr; -		u32 icr1; -		u32 icr2; -		u32 imr; -		u32 isr; -		u32 gpr; -		u32 swr; -		u32 puen; -		u32 res[0x2f]; -	} port[6]; -}; -  /* IIM Control Registers */  struct iim_regs {  	u32 iim_stat; @@ -217,6 +196,8 @@ struct fuse_bank0_regs {  #endif +#define ARCH_MXC +  #define IMX_IO_BASE		0x10000000  #define IMX_AIPI1_BASE		(0x00000 + IMX_IO_BASE) @@ -224,6 +205,7 @@ struct fuse_bank0_regs {  #define IMX_TIM1_BASE		(0x03000 + IMX_IO_BASE)  #define IMX_TIM2_BASE		(0x04000 + IMX_IO_BASE)  #define IMX_TIM3_BASE		(0x05000 + IMX_IO_BASE) +#define IMX_RTC_BASE		(0x07000 + IMX_IO_BASE)  #define UART1_BASE		(0x0a000 + IMX_IO_BASE)  #define UART2_BASE		(0x0b000 + IMX_IO_BASE)  #define UART3_BASE		(0x0c000 + IMX_IO_BASE) @@ -471,6 +453,13 @@ struct fuse_bank0_regs {  #define TSTAT_CAPT	(1 << 1)	/* Capture event */  #define TSTAT_COMP	1		/* Compare event */ +#define GPIO1_BASE_ADDR 0x10015000 +#define GPIO2_BASE_ADDR 0x10015100 +#define GPIO3_BASE_ADDR 0x10015200 +#define GPIO4_BASE_ADDR 0x10015300 +#define GPIO5_BASE_ADDR 0x10015400 +#define GPIO6_BASE_ADDR 0x10015500 +  #define GPIO_PIN_MASK	0x1f  #define GPIO_PORT_SHIFT	5 diff --git a/arch/arm/include/asm/arch-mx27/regs-rtc.h b/arch/arm/include/asm/arch-mx27/regs-rtc.h new file mode 100644 index 000000000..4f92d0f8f --- /dev/null +++ b/arch/arm/include/asm/arch-mx27/regs-rtc.h @@ -0,0 +1,40 @@ +/* + * Freescale i.MX27 RTC Register Definitions + * + * Copyright (C) 2012 Philippe Reynes <tremyfr@yahoo.fr> + * + * 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 __MX27_REGS_RTC_H__ +#define __MX27_REGS_RTC_H__ + +#ifndef	__ASSEMBLY__ +struct rtc_regs { +	u32 hourmin; +	u32 seconds; +	u32 alrm_hm; +	u32 alrm_sec; +	u32 rtcctl; +	u32 rtcisr; +	u32 rtcienr; +	u32 stpwch; +	u32 dayr; +	u32 dayalarm; +}; +#endif /* __ASSEMBLY__*/ + +#endif	/* __MX28_REGS_RTC_H__ */ diff --git a/arch/arm/include/asm/arch-mx31/clock.h b/arch/arm/include/asm/arch-mx31/clock.h index 852c19c1a..9468b45fe 100644 --- a/arch/arm/include/asm/arch-mx31/clock.h +++ b/arch/arm/include/asm/arch-mx31/clock.h @@ -24,6 +24,20 @@  #ifndef __ASM_ARCH_CLOCK_H  #define __ASM_ARCH_CLOCK_H +#include <common.h> + +#ifdef CONFIG_MX31_HCLK_FREQ +#define MXC_HCLK	CONFIG_MX31_HCLK_FREQ +#else +#define MXC_HCLK	26000000 +#endif + +#ifdef CONFIG_MX31_CLK32 +#define MXC_CLK32	CONFIG_MX31_CLK32 +#else +#define MXC_CLK32	32768 +#endif +  enum mxc_clock {  	MXC_ARM_CLK,  	MXC_IPG_CLK, diff --git a/arch/arm/include/asm/arch-mx31/gpio.h b/arch/arm/include/asm/arch-mx31/gpio.h index 95b73bfc3..55c0afa80 100644 --- a/arch/arm/include/asm/arch-mx31/gpio.h +++ b/arch/arm/include/asm/arch-mx31/gpio.h @@ -25,11 +25,6 @@  #ifndef __ASM_ARCH_MX31_GPIO_H  #define __ASM_ARCH_MX31_GPIO_H -/* GPIO Registers */ -struct gpio_regs { -	u32	gpio_dr; -	u32	gpio_dir; -	u32	gpio_psr; -}; +#include <asm/imx-common/gpio.h>  #endif diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h b/arch/arm/include/asm/arch-mx31/imx-regs.h index 7ddbbd627..1dd952c55 100644 --- a/arch/arm/include/asm/arch-mx31/imx-regs.h +++ b/arch/arm/include/asm/arch-mx31/imx-regs.h @@ -541,6 +541,8 @@ struct esdc_regs {  #endif +#define ARCH_MXC +  #define __REG(x)     (*((volatile u32 *)(x)))  #define __REG16(x)   (*((volatile u16 *)(x)))  #define __REG8(x)    (*((volatile u8 *)(x))) @@ -669,7 +671,7 @@ struct esdc_regs {  #define IPU_CONF_PF_EN		(1<<3)  #define IPU_CONF_ROT_EN		(1<<2)  #define IPU_CONF_IC_EN		(1<<1) -#define IPU_CONF_SCI_EN		(1<<0) +#define IPU_CONF_CSI_EN		(1<<0)  #define ARM_PPMRR		0x40000015 diff --git a/arch/arm/include/asm/arch-mx35/clock.h b/arch/arm/include/asm/arch-mx35/clock.h index 4c0ddfd44..eb7458a33 100644 --- a/arch/arm/include/asm/arch-mx35/clock.h +++ b/arch/arm/include/asm/arch-mx35/clock.h @@ -24,8 +24,22 @@  #ifndef __ASM_ARCH_CLOCK_H  #define __ASM_ARCH_CLOCK_H +#include <common.h> + +#ifdef CONFIG_MX35_HCLK_FREQ +#define MXC_HCLK	CONFIG_MX35_HCLK_FREQ +#else +#define MXC_HCLK	24000000 +#endif + +#ifdef CONFIG_MX35_CLK32 +#define MXC_CLK32	CONFIG_MX35_CLK32 +#else +#define MXC_CLK32	32768 +#endif +  enum mxc_clock { -	MXC_ARM_CLK = 0, +	MXC_ARM_CLK,  	MXC_AHB_CLK,  	MXC_IPG_CLK,  	MXC_IPG_PERCLK, @@ -36,7 +50,31 @@ enum mxc_clock {  	MXC_FEC_CLK,  }; -unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref); +enum mxc_main_clock { +	CPU_CLK, +	AHB_CLK, +	IPG_CLK, +	IPG_PER_CLK, +	NFC_CLK, +	USB_CLK, +	HSP_CLK, +}; + +enum mxc_peri_clock { +	UART1_BAUD, +	UART2_BAUD, +	UART3_BAUD, +	SSI1_BAUD, +	SSI2_BAUD, +	CSI_BAUD, +	MSHC_CLK, +	ESDHC1_CLK, +	ESDHC2_CLK, +	ESDHC3_CLK, +	SPDIF_CLK, +	SPI1_CLK, +	SPI2_CLK, +};  u32 imx_get_uartclk(void);  u32 imx_get_fecclk(void); diff --git a/arch/arm/include/asm/arch-mx35/crm_regs.h b/arch/arm/include/asm/arch-mx35/crm_regs.h index e903cf1c4..3fcde0ba5 100644 --- a/arch/arm/include/asm/arch-mx35/crm_regs.h +++ b/arch/arm/include/asm/arch-mx35/crm_regs.h @@ -32,8 +32,8 @@  #define MXC_CCM_CCMR_VOL_RDY_CNT_MASK          (0xF << 20)  #define MXC_CCM_CCMR_ROMW_OFFSET               18  #define MXC_CCM_CCMR_ROMW_MASK                 (0x3 << 18) -#define MXC_CCM_CCMR_RAMW_OFFSET               21 -#define MXC_CCM_CCMR_RAMW_MASK                 (0x3 << 21) +#define MXC_CCM_CCMR_RAMW_OFFSET               16 +#define MXC_CCM_CCMR_RAMW_MASK                 (0x3 << 16)  #define MXC_CCM_CCMR_LPM_OFFSET                 14  #define MXC_CCM_CCMR_LPM_MASK                   (0x3 << 14)  #define MXC_CCM_CCMR_UPE                        (1 << 9) @@ -47,7 +47,7 @@  #define MXC_CCM_PDR0_CON_MUX_DIV_MASK           (0xF << 16)  #define MXC_CCM_PDR0_CKIL_SEL			(1 << 15)  #define MXC_CCM_PDR0_PER_PODF_OFFSET            12 -#define MXC_CCM_PDR0_PER_PODF_MASK              (0xF << 12) +#define MXC_CCM_PDR0_PER_PODF_MASK              (0x7 << 12)  #define MXC_CCM_PDR0_AUTO_MUX_DIV_OFFSET        9  #define MXC_CCM_PDR0_AUTO_MUX_DIV_MASK          (0x7 << 9)  #define MXC_CCM_PDR0_AUTO_CON	                0x1 @@ -62,10 +62,8 @@  #define MXC_CCM_PDR2_SSI2_PRDF_MASK             (0x7 << 27)  #define MXC_CCM_PDR2_SSI1_PRDF_OFFSET           24  #define MXC_CCM_PDR2_SSI1_PRDF_MASK             (0x7 << 24) -#define MXC_CCM_PDR2_CSI_PRDF_OFFSET            19 -#define MXC_CCM_PDR2_CSI_PRDF_MASK              (0x7 << 19)  #define MXC_CCM_PDR2_CSI_PODF_OFFSET            16 -#define MXC_CCM_PDR2_CSI_PODF_MASK              (0x7 << 16) +#define MXC_CCM_PDR2_CSI_PODF_MASK              (0x3F << 16)  #define MXC_CCM_PDR2_SSI2_PODF_OFFSET           8  #define MXC_CCM_PDR2_SSI2_PODF_MASK             (0x3F << 8)  #define MXC_CCM_PDR2_CSI_M_U			(1 << 7) @@ -78,35 +76,23 @@  #define MXC_CCM_PDR3_SPDIF_PODF_OFFSET          23  #define MXC_CCM_PDR3_SPDIF_PODF_MASK            (0x3F << 23)  #define MXC_CCM_PDR3_SPDIF_M_U			(1 << 22) -#define MXC_CCM_PDR3_ESDHC3_PRDF_OFFSET         19 -#define MXC_CCM_PDR3_ESDHC3_PRDF_MASK           (0x7 << 19)  #define MXC_CCM_PDR3_ESDHC3_PODF_OFFSET         16 -#define MXC_CCM_PDR3_ESDHC3_PODF_MASK           (0x7 << 16) -#define MXC_CCM_PDR3_UART_M_U			(1 << 15) -#define MXC_CCM_PDR3_ESDHC2_PRDF_OFFSET         11 -#define MXC_CCM_PDR3_ESDHC2_PRDF_MASK           (0x7 << 11) +#define MXC_CCM_PDR3_ESDHC3_PODF_MASK           (0x3F << 16) +#define MXC_CCM_PDR3_UART_M_U			(1 << 14)  #define MXC_CCM_PDR3_ESDHC2_PODF_OFFSET         8 -#define MXC_CCM_PDR3_ESDHC2_PODF_MASK           (0x7 << 8) +#define MXC_CCM_PDR3_ESDHC2_PODF_MASK           (0x3F << 8)  #define MXC_CCM_PDR3_ESDHC_M_U			(1 << 6) -#define MXC_CCM_PDR3_ESDHC1_PRDF_OFFSET         3 -#define MXC_CCM_PDR3_ESDHC1_PRDF_MASK           (0x7 << 3)  #define MXC_CCM_PDR3_ESDHC1_PODF_OFFSET         0 -#define MXC_CCM_PDR3_ESDHC1_PODF_MASK           (0x7) +#define MXC_CCM_PDR3_ESDHC1_PODF_MASK           (0x3F)  #define MXC_CCM_PDR4_NFC_PODF_OFFSET		28  #define MXC_CCM_PDR4_NFC_PODF_MASK		(0xF << 28) -#define MXC_CCM_PDR4_USB_PRDF_OFFSET		25 -#define MXC_CCM_PDR4_USB_PRDF_MASK		(0x7 << 25)  #define MXC_CCM_PDR4_USB_PODF_OFFSET		22 -#define MXC_CCM_PDR4_USB_PODF_MASK		(0x7 << 22) -#define MXC_CCM_PDR4_PER0_PRDF_OFFSET		19 -#define MXC_CCM_PDR4_PER0_PRDF_MASK		(0x7 << 19) +#define MXC_CCM_PDR4_USB_PODF_MASK		(0x3F << 22)  #define MXC_CCM_PDR4_PER0_PODF_OFFSET		16 -#define MXC_CCM_PDR4_PER0_PODF_MASK		(0x7 << 16) -#define MXC_CCM_PDR4_UART_PRDF_OFFSET		13 -#define MXC_CCM_PDR4_UART_PRDF_MASK		(0x7 << 13) +#define MXC_CCM_PDR4_PER0_PODF_MASK		(0x3F << 16)  #define MXC_CCM_PDR4_UART_PODF_OFFSET		10 -#define MXC_CCM_PDR4_UART_PODF_MASK		(0x7 << 10) +#define MXC_CCM_PDR4_UART_PODF_MASK		(0x3F << 10)  #define MXC_CCM_PDR4_USB_M_U			(1 << 9)  /* Bit definitions for RCSR */ @@ -144,6 +130,12 @@  #define MXC_CCM_ACMR_SSI2_CLK_SEL_MASK		(0xF << 0)  /* Bit definitions for Clock gating Register*/ +#define MXC_CCM_CGR_CG_MASK			0x3 +#define MXC_CCM_CGR_CG_OFF			0x0 +#define MXC_CCM_CGR_CG_RUN_ON			0x1 +#define MXC_CCM_CGR_CG_RUN_WAIT_ON		0x2 +#define MXC_CCM_CGR_CG_ON			0x3 +  #define MXC_CCM_CGR0_ASRC_OFFSET		0  #define MXC_CCM_CGR0_ASRC_MASK			(0x3 << 0)  #define MXC_CCM_CGR0_ATA_OFFSET			2 @@ -158,8 +150,8 @@  #define MXC_CCM_CGR0_CSPI2_MASK			(0x3 << 12)  #define MXC_CCM_CGR0_ECT_OFFSET			14  #define MXC_CCM_CGR0_ECT_MASK			(0x3 << 14) -#define MXC_CCM_CGR0_EDI0_OFFSET		16 -#define MXC_CCM_CGR0_EDI0_MASK			(0x3 << 16) +#define MXC_CCM_CGR0_EDIO_OFFSET		16 +#define MXC_CCM_CGR0_EDIO_MASK			(0x3 << 16)  #define MXC_CCM_CGR0_EMI_OFFSET			18  #define MXC_CCM_CGR0_EMI_MASK			(0x3 << 18)  #define MXC_CCM_CGR0_EPIT1_OFFSET		20 @@ -251,10 +243,8 @@  #define MXC_CCM_COSR_CLKOSEL_OFFSET		0  #define MXC_CCM_COSR_CLKOEN			(1 << 5)  #define MXC_CCM_COSR_CLKOUTDIV_1		(1 << 6) -#define MXC_CCM_COSR_CLKOUT_PREDIV_MASK		(0x7 << 10) -#define MXC_CCM_COSR_CLKOUT_PREDIV_OFFSET	10 -#define MXC_CCM_COSR_CLKOUT_PRODIV_MASK		(0x7 << 13) -#define MXC_CCM_COSR_CLKOUT_PRODIV_OFFSET	13 +#define MXC_CCM_COSR_CLKOUT_DIV_MASK		(0x3F << 10) +#define MXC_CCM_COSR_CLKOUT_DIV_OFFSET		10  #define MXC_CCM_COSR_SSI1_RX_SRC_SEL_MASK	(0x3 << 16)  #define MXC_CCM_COSR_SSI1_RX_SRC_SEL_OFFSET	16  #define MXC_CCM_COSR_SSI1_TX_SRC_SEL_MASK	(0x3 << 18) diff --git a/arch/arm/include/asm/arch-mx35/gpio.h b/arch/arm/include/asm/arch-mx35/gpio.h index 7bcc3e868..1deb2927a 100644 --- a/arch/arm/include/asm/arch-mx35/gpio.h +++ b/arch/arm/include/asm/arch-mx35/gpio.h @@ -25,16 +25,6 @@  #ifndef __ASM_ARCH_MX35_GPIO_H  #define __ASM_ARCH_MX35_GPIO_H -/* GPIO registers */ -struct gpio_regs { -	u32 gpio_dr;	/* data */ -	u32 gpio_dir;	/* direction */ -	u32 psr;	/* pad satus */ -	u32 icr1;	/* interrupt config 1 */ -	u32 icr2;	/* interrupt config 2 */ -	u32 imr;	/* interrupt mask */ -	u32 isr;	/* interrupt status */ -	u32 edge_sel;	/* edge select */ -}; +#include <asm/imx-common/gpio.h>  #endif diff --git a/arch/arm/include/asm/arch-mx35/imx-regs.h b/arch/arm/include/asm/arch-mx35/imx-regs.h index 314600621..2c6e59c32 100644 --- a/arch/arm/include/asm/arch-mx35/imx-regs.h +++ b/arch/arm/include/asm/arch-mx35/imx-regs.h @@ -25,6 +25,8 @@  #ifndef __ASM_ARCH_MX35_H  #define __ASM_ARCH_MX35_H +#define ARCH_MXC +  /*   * IRAM   */ @@ -72,7 +74,6 @@  #define MMC_SDHC2_BASE_ADDR	0x53FB8000  #define MMC_SDHC3_BASE_ADDR	0x53FBC000  #define IPU_CTRL_BASE_ADDR	0x53FC0000 -#define GPIO3_BASE_ADDR		0x53FA4000  #define GPIO1_BASE_ADDR		0x53FCC000  #define GPIO2_BASE_ADDR		0x53FD0000  #define SDMA_BASE_ADDR		0x53FD4000 @@ -177,7 +178,7 @@  #define IPU_CONF_PF_EN		(1<<3)  #define IPU_CONF_ROT_EN		(1<<2)  #define IPU_CONF_IC_EN		(1<<1) -#define IPU_CONF_SCI_EN		(1<<0) +#define IPU_CONF_CSI_EN		(1<<0)  /*   * CSPI register definitions @@ -216,32 +217,6 @@  #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))  #include <asm/types.h> -enum mxc_main_clocks { -	CPU_CLK, -	AHB_CLK, -	IPG_CLK, -	IPG_PER_CLK, -	NFC_CLK, -	USB_CLK, -	HSP_CLK, -}; - -enum mxc_peri_clocks { -	UART1_BAUD, -	UART2_BAUD, -	UART3_BAUD, -	SSI1_BAUD, -	SSI2_BAUD, -	CSI_BAUD, -	MSHC_CLK, -	ESDHC1_CLK, -	ESDHC2_CLK, -	ESDHC3_CLK, -	SPDIF_CLK, -	SPI1_CLK, -	SPI2_CLK, -}; -  /* Clock Control Module (CCM) registers */  struct ccm_regs {  	u32 ccmr;	/* Control */ diff --git a/arch/arm/include/asm/arch-mx35/mx35_pins.h b/arch/arm/include/asm/arch-mx35/mx35_pins.h index 8c3813911..00e5e7583 100644 --- a/arch/arm/include/asm/arch-mx35/mx35_pins.h +++ b/arch/arm/include/asm/arch-mx35/mx35_pins.h @@ -347,9 +347,6 @@ typedef enum iomux_pins {  	MX35_PIN_FEC_TDATA2 = _MXC_BUILD_GPIO_PIN(2, 21, 0x31C, 0x780),  	MX35_PIN_FEC_RDATA3 = _MXC_BUILD_GPIO_PIN(2, 22, 0x320, 0x784),  	MX35_PIN_FEC_TDATA3 = _MXC_BUILD_GPIO_PIN(2, 23, 0x324, 0x788), - -	MX35_PIN_RTS2_UART3_RXD_MUX = _MXC_BUILD_NON_GPIO_PIN(0x1a0, 0x5e4), -	MX35_PIN_CTS2_UART3_TXD_MUX = _MXC_BUILD_NON_GPIO_PIN(0x1a4, 0x5e8),  } iomux_pin_name_t;  #endif diff --git a/arch/arm/include/asm/arch-mx35/sys_proto.h b/arch/arm/include/asm/arch-mx35/sys_proto.h index 422eb520a..9c0d51321 100644 --- a/arch/arm/include/asm/arch-mx35/sys_proto.h +++ b/arch/arm/include/asm/arch-mx35/sys_proto.h @@ -26,6 +26,5 @@  u32 get_cpu_rev(void);  #define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev) -void sdelay(unsigned long);  #endif diff --git a/arch/arm/include/asm/arch-mx5/clock.h b/arch/arm/include/asm/arch-mx5/clock.h index 36ea03082..8d8fa18fc 100644 --- a/arch/arm/include/asm/arch-mx5/clock.h +++ b/arch/arm/include/asm/arch-mx5/clock.h @@ -38,8 +38,6 @@ enum mxc_clock {  	MXC_PERIPH_CLK,  }; -unsigned int imx_decode_pll(unsigned int pll, unsigned int f_ref); -  u32 imx_get_uartclk(void);  u32 imx_get_fecclk(void);  unsigned int mxc_get_clock(enum mxc_clock clk); diff --git a/arch/arm/include/asm/arch-mx5/gpio.h b/arch/arm/include/asm/arch-mx5/gpio.h index 1dc34e916..b1b121808 100644 --- a/arch/arm/include/asm/arch-mx5/gpio.h +++ b/arch/arm/include/asm/arch-mx5/gpio.h @@ -25,11 +25,6 @@  #ifndef __ASM_ARCH_MX5_GPIO_H  #define __ASM_ARCH_MX5_GPIO_H -/* GPIO registers */ -struct gpio_regs { -	u32	gpio_dr; -	u32	gpio_dir; -	u32	gpio_psr; -}; +#include <asm/imx-common/gpio.h>  #endif diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h b/arch/arm/include/asm/arch-mx5/imx-regs.h index 7f66b61b3..d1ef15d04 100644 --- a/arch/arm/include/asm/arch-mx5/imx-regs.h +++ b/arch/arm/include/asm/arch-mx5/imx-regs.h @@ -23,6 +23,8 @@  #ifndef __ASM_ARCH_MX5_IMX_REGS_H__  #define __ASM_ARCH_MX5_IMX_REGS_H__ +#define ARCH_MXC +  #if defined(CONFIG_MX51)  #define IRAM_BASE_ADDR		0x1FFE0000	/* internal ram */  #define IPU_SOC_BASE_ADDR	0x40000000 @@ -459,6 +461,24 @@ struct src {  	u32	simr;  }; +struct srtc_regs { +	u32	lpscmr;		/* 0x00 */ +	u32	lpsclr;		/* 0x04 */ +	u32	lpsar;		/* 0x08 */ +	u32	lpsmcr;		/* 0x0c */ +	u32	lpcr;		/* 0x10 */ +	u32	lpsr;		/* 0x14 */ +	u32	lppdr;		/* 0x18 */ +	u32	lpgr;		/* 0x1c */ +	u32	hpcmr;		/* 0x20 */ +	u32	hpclr;		/* 0x24 */ +	u32	hpamr;		/* 0x28 */ +	u32	hpalr;		/* 0x2c */ +	u32	hpcr;		/* 0x30 */ +	u32	hpisr;		/* 0x34 */ +	u32	hpienr;		/* 0x38 */ +}; +  /* CSPI registers */  struct cspi_regs {  	u32 rxdata; diff --git a/arch/arm/include/asm/arch-mx5/iomux-mx51.h b/arch/arm/include/asm/arch-mx5/iomux-mx51.h new file mode 100644 index 000000000..4f3729599 --- /dev/null +++ b/arch/arm/include/asm/arch-mx5/iomux-mx51.h @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com> + * Copyright (C) 2010 Freescale Semiconductor, Inc. + * Copyright (C) 2009-2012 Genesi USA, Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/* + * The vast majority of this file is taken from the Linux kernel at + * commit 5d23b39 + */ + +#ifndef __IOMUX_MX51_H__ +#define __IOMUX_MX51_H__ + +#include <asm/imx-common/iomux-v3.h> + +#define PAD_CTL_DVS			(1 << 13) +#define PAD_CTL_INPUT_DDR		(1 << 9) +#define PAD_CTL_HYS			(1 << 8) + +#define PAD_CTL_PKE			(1 << 7) +#define PAD_CTL_PUE			(1 << 6 | PAD_CTL_PKE) +#define PAD_CTL_PUS_100K_DOWN		(0 << 4 | PAD_CTL_PUE) +#define PAD_CTL_PUS_47K_UP		(1 << 4 | PAD_CTL_PUE) +#define PAD_CTL_PUS_100K_UP		(2 << 4 | PAD_CTL_PUE) +#define PAD_CTL_PUS_22K_UP		(3 << 4 | PAD_CTL_PUE) + +#define PAD_CTL_ODE			(1 << 3) + +#define PAD_CTL_DSE_LOW			(0 << 1) +#define PAD_CTL_DSE_MED			(1 << 1) +#define PAD_CTL_DSE_HIGH		(2 << 1) +#define PAD_CTL_DSE_MAX			(3 << 1) + +#define PAD_CTL_SRE_FAST		(1 << 0) +#define PAD_CTL_SRE_SLOW		(0 << 0) + +/* Pad control groupings */ +#define MX51_UART_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_DSE_HIGH | \ +				PAD_CTL_HYS | PAD_CTL_SRE_FAST) +#define MX51_I2C_PAD_CTRL	(PAD_CTL_SRE_FAST | PAD_CTL_ODE | \ +				PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \ +				PAD_CTL_HYS) +#define MX51_ESDHC_PAD_CTRL	(PAD_CTL_SRE_FAST | PAD_CTL_ODE | \ +				PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \ +				PAD_CTL_HYS) +#define MX51_USBH1_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_SRE_FAST | \ +				PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | \ +				PAD_CTL_HYS | PAD_CTL_PUE) +#define MX51_ECSPI_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_HYS | \ +				PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST) +#define MX51_SDHCI_PAD_CTRL	(PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ +				PAD_CTL_PUS_47K_UP | PAD_CTL_PUE | \ +				PAD_CTL_SRE_FAST | PAD_CTL_DVS) +#define MX51_GPIO_PAD_CTRL	(PAD_CTL_DSE_HIGH | PAD_CTL_PKE | PAD_CTL_SRE_FAST) + +#define __NA_ 0x000 + +/* + * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode> + * If <padname> or <padmode> refers to a GPIO, it is named GPIO<unit>_<num> + * See also iomux-v3.h + */ + +/*								PAD    MUX   ALT INPSE PATH PADCTRL */ +enum { +	MX51_PAD_EIM_D16__USBH2_DATA0		= IOMUX_PAD(0x3f0, 0x05c, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D17__USBH2_DATA1		= IOMUX_PAD(0x3f4, 0x060, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D18__USBH2_DATA2		= IOMUX_PAD(0x3f8, 0x064, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D19__USBH2_DATA3		= IOMUX_PAD(0x3fc, 0x068, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D20__USBH2_DATA4		= IOMUX_PAD(0x400, 0x06c, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D21__USBH2_DATA5		= IOMUX_PAD(0x404, 0x070, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D22__USBH2_DATA6		= IOMUX_PAD(0x408, 0x074, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D23__USBH2_DATA7		= IOMUX_PAD(0x40c, 0x078, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_D27__GPIO2_9		= IOMUX_PAD(0x41c, 0x088, 1, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_EIM_A24__USBH2_CLK		= IOMUX_PAD(0x450, 0x0bc, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_A25__USBH2_DIR		= IOMUX_PAD(0x454, 0x0c0, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_A26__GPIO2_20		= IOMUX_PAD(0x458, 0x0c4, 1, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_EIM_A26__USBH2_STP		= IOMUX_PAD(0x458, 0x0c4, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_A27__USBH2_NXT		= IOMUX_PAD(0x45c, 0x0c8, 2, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_EIM_CS0__GPIO2_25		= IOMUX_PAD(0x474, 0x0e0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_EIM_CS2__SD1_CD		= IOMUX_PAD(0x47c, 0x0e8, 1, __NA_, 0, MX51_ESDHC_PAD_CTRL), +	MX51_PAD_EIM_CS3__GPIO2_28		= IOMUX_PAD(0x480, 0x0ec, 1, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_EIM_CS4__GPIO2_29		= IOMUX_PAD(0x484, 0x0f0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_NANDF_WE_B__PATA_DIOW		= IOMUX_PAD(0x4e4, 0x108, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_RE_B__PATA_DIOR		= IOMUX_PAD(0x4e8, 0x10c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_ALE__PATA_BUFFER_EN	= IOMUX_PAD(0x4ec, 0x110, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CLE__PATA_RESET_B	= IOMUX_PAD(0x4f0, 0x114, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_WP_B__PATA_DMACK		= IOMUX_PAD(0x4f4, 0x118, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_RB0__PATA_DMARQ		= IOMUX_PAD(0x4f8, 0x11c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_RB1__PATA_IORDY		= IOMUX_PAD(0x4fc, 0x120, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_GPIO_NAND__PATA_INTRQ		= IOMUX_PAD(0x514, 0x12c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CS2__PATA_CS_0		= IOMUX_PAD(0x520, 0x138, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CS3__PATA_CS_1		= IOMUX_PAD(0x524, 0x13c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CS4__PATA_DA_0		= IOMUX_PAD(0x528, 0x140, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CS5__PATA_DA_1		= IOMUX_PAD(0x52c, 0x144, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_CS6__PATA_DA_2		= IOMUX_PAD(0x530, 0x148, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D15__PATA_DATA15		= IOMUX_PAD(0x53c, 0x154, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D14__PATA_DATA14		= IOMUX_PAD(0x540, 0x158, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D13__PATA_DATA13		= IOMUX_PAD(0x544, 0x15c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D12__PATA_DATA12		= IOMUX_PAD(0x548, 0x160, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D11__PATA_DATA11		= IOMUX_PAD(0x54c, 0x164, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D10__PATA_DATA10		= IOMUX_PAD(0x550, 0x168, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D9__PATA_DATA9		= IOMUX_PAD(0x554, 0x16c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D8__PATA_DATA8		= IOMUX_PAD(0x558, 0x170, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D7__PATA_DATA7		= IOMUX_PAD(0x55c, 0x174, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D6__PATA_DATA6		= IOMUX_PAD(0x560, 0x178, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D5__PATA_DATA5		= IOMUX_PAD(0x564, 0x17c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D4__PATA_DATA4		= IOMUX_PAD(0x568, 0x180, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D3__PATA_DATA3		= IOMUX_PAD(0x56c, 0x184, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D2__PATA_DATA2		= IOMUX_PAD(0x570, 0x188, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D1__PATA_DATA1		= IOMUX_PAD(0x574, 0x18c, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_NANDF_D0__PATA_DATA0		= IOMUX_PAD(0x578, 0x190, 1, __NA_, 0, NO_PAD_CTRL), +	MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI	= IOMUX_PAD(0x600, 0x210, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL), +	MX51_PAD_CSPI1_MISO__ECSPI1_MISO	= IOMUX_PAD(0x604, 0x214, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL), +	MX51_PAD_CSPI1_SS0__GPIO4_24		= IOMUX_PAD(0x608, 0x218, 3, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_CSPI1_SS1__GPIO4_25		= IOMUX_PAD(0x60c, 0x21c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK	= IOMUX_PAD(0x614, 0x224, 0, __NA_, 0, MX51_ECSPI_PAD_CTRL), +	MX51_PAD_UART1_RXD__UART1_RXD		= IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART_PAD_CTRL), +	MX51_PAD_UART1_TXD__UART1_TXD		= IOMUX_PAD(0x61c, 0x22c, 0, __NA_, 0, MX51_UART_PAD_CTRL), +	MX51_PAD_UART1_RTS__UART1_RTS		= IOMUX_PAD(0x620, 0x230, 0, 0x9e0, 0, MX51_UART_PAD_CTRL), +	MX51_PAD_UART1_CTS__UART1_CTS		= IOMUX_PAD(0x624, 0x234, 0, __NA_, 0, MX51_UART_PAD_CTRL), +	MX51_PAD_USBH1_CLK__USBH1_CLK		= IOMUX_PAD(0x678, 0x278, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DIR__USBH1_DIR		= IOMUX_PAD(0x67c, 0x27c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_STP__USBH1_STP		= IOMUX_PAD(0x680, 0x280, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_STP__GPIO1_27		= IOMUX_PAD(0x680, 0x280, 2, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_USBH1_NXT__USBH1_NXT		= IOMUX_PAD(0x684, 0x284, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA0__USBH1_DATA0	= IOMUX_PAD(0x688, 0x288, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA1__USBH1_DATA1	= IOMUX_PAD(0x68c, 0x28c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA2__USBH1_DATA2	= IOMUX_PAD(0x690, 0x290, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA3__USBH1_DATA3	= IOMUX_PAD(0x694, 0x294, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA4__USBH1_DATA4	= IOMUX_PAD(0x698, 0x298, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA5__USBH1_DATA5	= IOMUX_PAD(0x69c, 0x29c, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA6__USBH1_DATA6	= IOMUX_PAD(0x6a0, 0x2a0, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_USBH1_DATA7__USBH1_DATA7	= IOMUX_PAD(0x6a4, 0x2a4, 0, __NA_, 0, MX51_USBH1_PAD_CTRL), +	MX51_PAD_SD1_CMD__SD1_CMD		= IOMUX_PAD(0x79c, 0x394, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD1_CLK__SD1_CLK		= IOMUX_PAD(0x7a0, 0x398, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS), +	MX51_PAD_SD1_DATA0__SD1_DATA0		= IOMUX_PAD(0x7a4, 0x39c, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD1_DATA1__SD1_DATA1		= IOMUX_PAD(0x7a8, 0x3a0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD1_DATA2__SD1_DATA2		= IOMUX_PAD(0x7ac, 0x3a4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD1_DATA3__SD1_DATA3		= IOMUX_PAD(0x7b0, 0x3a8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_GPIO1_0__SD1_CD		= IOMUX_PAD(0x7b4, 0x3ac, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL), +	MX51_PAD_GPIO1_1__SD1_WP		= IOMUX_PAD(0x7b8, 0x3b0, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL), +	MX51_PAD_SD2_CMD__SD2_CMD		= IOMUX_PAD(0x7bc, 0x3b4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD2_CLK__SD2_CLK		= IOMUX_PAD(0x7c0, 0x3b8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS), +	MX51_PAD_SD2_DATA0__SD2_DATA0		= IOMUX_PAD(0x7c4, 0x3bc, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD2_DATA1__SD2_DATA1		= IOMUX_PAD(0x7c8, 0x3c0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD2_DATA2__SD2_DATA2		= IOMUX_PAD(0x7cc, 0x3c4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_SD2_DATA3__SD2_DATA3		= IOMUX_PAD(0x7d0, 0x3c8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL), +	MX51_PAD_GPIO1_3__GPIO1_3		= IOMUX_PAD(0x7d8, 0x3d0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_GPIO1_5__GPIO1_5		= IOMUX_PAD(0x808, 0x3dc, 0, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_GPIO1_6__GPIO1_6		= IOMUX_PAD(0x80c, 0x3e0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL), +	MX51_PAD_GPIO1_7__SD2_WP		= IOMUX_PAD(0x810, 0x3e4, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL), +	MX51_PAD_GPIO1_8__SD2_CD		= IOMUX_PAD(0x814, 0x3e8, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL), +}; + +#endif /* __IOMUX_MX51_H__ */ diff --git a/arch/arm/include/asm/arch-mx6/gpio.h b/arch/arm/include/asm/arch-mx6/gpio.h index 20c4e5748..24c10f8bc 100644 --- a/arch/arm/include/asm/arch-mx6/gpio.h +++ b/arch/arm/include/asm/arch-mx6/gpio.h @@ -25,11 +25,6 @@  #ifndef __ASM_ARCH_MX6_GPIO_H  #define __ASM_ARCH_MX6_GPIO_H -/* GPIO registers */ -struct gpio_regs { -	u32	gpio_dr; -	u32	gpio_dir; -	u32	gpio_psr; -}; +#include <asm/imx-common/gpio.h>  #endif	/* __ASM_ARCH_MX6_GPIO_H */ diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 5d77603eb..8834c59dc 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -19,6 +19,8 @@  #ifndef __ASM_ARCH_MX6_IMX_REGS_H__  #define __ASM_ARCH_MX6_IMX_REGS_H__ +#define ARCH_MXC +  #define CONFIG_SYS_CACHELINE_SIZE	32  #define ROMCP_ARB_BASE_ADDR             0x00000000 @@ -172,8 +174,6 @@  #define IMX_IIM_BASE                 OCOTP_BASE_ADDR  #define FEC_QUIRK_ENET_MAC -#define GPIO_NUMBER(port, index)		((((port)-1)*32)+((index)&31)) -  #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))  #include <asm/types.h> @@ -448,5 +448,26 @@ struct iomuxc_base_regs {  	u32     daisy[104];     /* 0x7b0..94c */  }; +struct src_regs { +	u32	scr;		/* 0x00 */ +	u32	sbmr1;		/* 0x04 */ +	u32	srsr;		/* 0x08 */ +	u32	reserved1;	/* 0x0c */ +	u32	reserved2;	/* 0x10 */ +	u32	sisr;		/* 0x14 */ +	u32	simr;		/* 0x18 */ +	u32	sbmr2;		/* 0x1c */ +	u32	gpr1;		/* 0x20 */ +	u32	gpr2;		/* 0x24 */ +	u32	gpr3;		/* 0x28 */ +	u32	gpr4;		/* 0x2c */ +	u32	gpr5;		/* 0x30 */ +	u32	gpr6;		/* 0x34 */ +	u32	gpr7;		/* 0x38 */ +	u32	gpr8;		/* 0x3c */ +	u32	gpr9;		/* 0x40 */ +	u32	gpr10;		/* 0x44 */ +}; +  #endif /* __ASSEMBLER__*/  #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */ diff --git a/arch/arm/include/asm/arch-mx6/iomux.h b/arch/arm/include/asm/arch-mx6/iomux.h new file mode 100644 index 000000000..d23abd764 --- /dev/null +++ b/arch/arm/include/asm/arch-mx6/iomux.h @@ -0,0 +1,129 @@ +/* + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#ifndef __ASM_ARCH_IOMUX_H__ +#define __ASM_ARCH_IOMUX_H__ +/* + * IOMUXC_GPR13 bit fields + */ +#define IOMUXC_GPR13_SDMA_STOP_REQ	(1<<30) +#define IOMUXC_GPR13_CAN2_STOP_REQ	(1<<29) +#define IOMUXC_GPR13_CAN1_STOP_REQ	(1<<28) +#define IOMUXC_GPR13_ENET_STOP_REQ	(1<<27) +#define IOMUXC_GPR13_SATA_PHY_8_MASK	(7<<24) +#define IOMUXC_GPR13_SATA_PHY_7_MASK	(0x1f<<19) +#define IOMUXC_GPR13_SATA_PHY_6_SHIFT	16 +#define IOMUXC_GPR13_SATA_PHY_6_MASK	(7<<IOMUXC_GPR13_SATA_PHY_6_SHIFT) +#define IOMUXC_GPR13_SATA_SPEED_MASK	(1<<15) +#define IOMUXC_GPR13_SATA_PHY_5_MASK	(1<<14) +#define IOMUXC_GPR13_SATA_PHY_4_MASK	(7<<11) +#define IOMUXC_GPR13_SATA_PHY_3_MASK	(0x1f<<7) +#define IOMUXC_GPR13_SATA_PHY_2_MASK	(0x1f<<2) +#define IOMUXC_GPR13_SATA_PHY_1_MASK	(3<<0) + +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_0P5DB	(0<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P0DB	(1<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P5DB	(2<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P0DB	(3<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P5DB	(4<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB	(5<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P5DB	(6<<24) +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_4P0DB	(7<<24) + +#define IOMUXC_GPR13_SATA_PHY_7_SATA1I	(0x10<<19) +#define IOMUXC_GPR13_SATA_PHY_7_SATA1M	(0x10<<19) +#define IOMUXC_GPR13_SATA_PHY_7_SATA1X	(0x1A<<19) +#define IOMUXC_GPR13_SATA_PHY_7_SATA2I	(0x12<<19) +#define IOMUXC_GPR13_SATA_PHY_7_SATA2M	(0x12<<19) +#define IOMUXC_GPR13_SATA_PHY_7_SATA2X	(0x1A<<19) + +#define IOMUXC_GPR13_SATA_SPEED_1P5G	(0<<15) +#define IOMUXC_GPR13_SATA_SPEED_3G	(1<<15) + +#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED	(0<<14) +#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_ENABLED		(1<<14) + +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_16_16	(0<<11) +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_14_16	(1<<11) +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_12_16	(2<<11) +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_10_16	(3<<11) +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16		(4<<11) +#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_8_16		(5<<11) + +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB	(0<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P37_DB	(1<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P74_DB	(2<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P11_DB	(3<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P48_DB	(4<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P85_DB	(5<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P22_DB	(6<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P59_DB	(7<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P96_DB	(8<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P33_DB	(9<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P70_DB	(0xA<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P07_DB	(0xB<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P44_DB	(0xC<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P81_DB	(0xD<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P28_DB	(0xE<<7) +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P75_DB	(0xF<<7) + +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P937V	(0<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P947V	(1<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P957V	(2<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P966V	(3<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P976V	(4<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P986V	(5<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P996V	(6<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P005V	(7<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P015V	(8<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P025V	(9<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P035V	(0xA<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P045V	(0xB<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P054V	(0xC<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P064V	(0xD<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P074V	(0xE<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P084V	(0xF<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P094V	(0x10<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P104V	(0x11<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P113V	(0x12<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P123V	(0x13<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P133V	(0x14<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P143V	(0x15<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P152V	(0x16<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P162V	(0x17<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P172V	(0x18<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P182V	(0x19<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P191V	(0x1A<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P201V	(0x1B<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P211V	(0x1C<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P221V	(0x1D<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P230V	(0x1E<<2) +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P240V	(0x1F<<2) + +#define IOMUXC_GPR13_SATA_PHY_1_FAST	0 +#define IOMUXC_GPR13_SATA_PHY_1_MEDIUM	1 +#define IOMUXC_GPR13_SATA_PHY_1_SLOW	2 + +#define IOMUXC_GPR13_SATA_MASK (IOMUXC_GPR13_SATA_PHY_8_MASK \ +				|IOMUXC_GPR13_SATA_PHY_7_MASK \ +				|IOMUXC_GPR13_SATA_PHY_6_MASK \ +				|IOMUXC_GPR13_SATA_SPEED_MASK \ +				|IOMUXC_GPR13_SATA_PHY_5_MASK \ +				|IOMUXC_GPR13_SATA_PHY_4_MASK \ +				|IOMUXC_GPR13_SATA_PHY_3_MASK \ +				|IOMUXC_GPR13_SATA_PHY_2_MASK \ +				|IOMUXC_GPR13_SATA_PHY_1_MASK) +#endif	/* __ASM_ARCH_IOMUX_H__ */ diff --git a/arch/arm/include/asm/arch-mx28/clock.h b/arch/arm/include/asm/arch-mxs/clock.h index 1700fe391..1700fe391 100644 --- a/arch/arm/include/asm/arch-mx28/clock.h +++ b/arch/arm/include/asm/arch-mxs/clock.h diff --git a/arch/arm/include/asm/arch-mx28/dma.h b/arch/arm/include/asm/arch-mxs/dma.h index 4a1820bde..a0a0ea501 100644 --- a/arch/arm/include/asm/arch-mx28/dma.h +++ b/arch/arm/include/asm/arch-mxs/dma.h @@ -27,6 +27,7 @@  #define __DMA_H__  #include <linux/list.h> +#include <linux/compiler.h>  #ifndef	CONFIG_ARCH_DMA_PIO_WORDS  #define	DMA_PIO_WORDS		15 @@ -109,7 +110,7 @@ struct mxs_dma_desc {  	dma_addr_t		address;  	void			*buffer;  	struct list_head	node; -}; +} __aligned(MXS_DMA_ALIGNMENT);  /**   * MXS DMA channel diff --git a/arch/arm/include/asm/arch-mx28/gpio.h b/arch/arm/include/asm/arch-mxs/gpio.h index be1c944eb..be1c944eb 100644 --- a/arch/arm/include/asm/arch-mx28/gpio.h +++ b/arch/arm/include/asm/arch-mxs/gpio.h diff --git a/arch/arm/include/asm/arch-mx28/imx-regs.h b/arch/arm/include/asm/arch-mxs/imx-regs.h index 37d0a9376..5e1901e6c 100644 --- a/arch/arm/include/asm/arch-mx28/imx-regs.h +++ b/arch/arm/include/asm/arch-mxs/imx-regs.h @@ -26,7 +26,7 @@  #include <asm/arch/regs-apbh.h>  #include <asm/arch/regs-base.h>  #include <asm/arch/regs-bch.h> -#include <asm/arch/regs-clkctrl.h> +#include <asm/arch/regs-clkctrl-mx28.h>  #include <asm/arch/regs-digctl.h>  #include <asm/arch/regs-gpmi.h>  #include <asm/arch/regs-i2c.h> diff --git a/arch/arm/include/asm/arch-mx28/iomux-mx28.h b/arch/arm/include/asm/arch-mxs/iomux-mx28.h index b42820de7..b42820de7 100644 --- a/arch/arm/include/asm/arch-mx28/iomux-mx28.h +++ b/arch/arm/include/asm/arch-mxs/iomux-mx28.h diff --git a/arch/arm/include/asm/arch-mx28/iomux.h b/arch/arm/include/asm/arch-mxs/iomux.h index 7abdf58b8..7abdf58b8 100644 --- a/arch/arm/include/asm/arch-mx28/iomux.h +++ b/arch/arm/include/asm/arch-mxs/iomux.h diff --git a/arch/arm/include/asm/arch-mx28/regs-apbh.h b/arch/arm/include/asm/arch-mxs/regs-apbh.h index 91d7bc840..e18e677e3 100644 --- a/arch/arm/include/asm/arch-mx28/regs-apbh.h +++ b/arch/arm/include/asm/arch-mxs/regs-apbh.h @@ -29,143 +29,143 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_apbh_regs { -	mx28_reg_32(hw_apbh_ctrl0) -	mx28_reg_32(hw_apbh_ctrl1) -	mx28_reg_32(hw_apbh_ctrl2) -	mx28_reg_32(hw_apbh_channel_ctrl) -	mx28_reg_32(hw_apbh_devsel) -	mx28_reg_32(hw_apbh_dma_burst_size) -	mx28_reg_32(hw_apbh_debug) +struct mxs_apbh_regs { +	mxs_reg_32(hw_apbh_ctrl0) +	mxs_reg_32(hw_apbh_ctrl1) +	mxs_reg_32(hw_apbh_ctrl2) +	mxs_reg_32(hw_apbh_channel_ctrl) +	mxs_reg_32(hw_apbh_devsel) +	mxs_reg_32(hw_apbh_dma_burst_size) +	mxs_reg_32(hw_apbh_debug)  	uint32_t	reserved[36];  	union {  	struct { -		mx28_reg_32(hw_apbh_ch_curcmdar) -		mx28_reg_32(hw_apbh_ch_nxtcmdar) -		mx28_reg_32(hw_apbh_ch_cmd) -		mx28_reg_32(hw_apbh_ch_bar) -		mx28_reg_32(hw_apbh_ch_sema) -		mx28_reg_32(hw_apbh_ch_debug1) -		mx28_reg_32(hw_apbh_ch_debug2) +		mxs_reg_32(hw_apbh_ch_curcmdar) +		mxs_reg_32(hw_apbh_ch_nxtcmdar) +		mxs_reg_32(hw_apbh_ch_cmd) +		mxs_reg_32(hw_apbh_ch_bar) +		mxs_reg_32(hw_apbh_ch_sema) +		mxs_reg_32(hw_apbh_ch_debug1) +		mxs_reg_32(hw_apbh_ch_debug2)  	} ch[16];  	struct { -		mx28_reg_32(hw_apbh_ch0_curcmdar) -		mx28_reg_32(hw_apbh_ch0_nxtcmdar) -		mx28_reg_32(hw_apbh_ch0_cmd) -		mx28_reg_32(hw_apbh_ch0_bar) -		mx28_reg_32(hw_apbh_ch0_sema) -		mx28_reg_32(hw_apbh_ch0_debug1) -		mx28_reg_32(hw_apbh_ch0_debug2) -		mx28_reg_32(hw_apbh_ch1_curcmdar) -		mx28_reg_32(hw_apbh_ch1_nxtcmdar) -		mx28_reg_32(hw_apbh_ch1_cmd) -		mx28_reg_32(hw_apbh_ch1_bar) -		mx28_reg_32(hw_apbh_ch1_sema) -		mx28_reg_32(hw_apbh_ch1_debug1) -		mx28_reg_32(hw_apbh_ch1_debug2) -		mx28_reg_32(hw_apbh_ch2_curcmdar) -		mx28_reg_32(hw_apbh_ch2_nxtcmdar) -		mx28_reg_32(hw_apbh_ch2_cmd) -		mx28_reg_32(hw_apbh_ch2_bar) -		mx28_reg_32(hw_apbh_ch2_sema) -		mx28_reg_32(hw_apbh_ch2_debug1) -		mx28_reg_32(hw_apbh_ch2_debug2) -		mx28_reg_32(hw_apbh_ch3_curcmdar) -		mx28_reg_32(hw_apbh_ch3_nxtcmdar) -		mx28_reg_32(hw_apbh_ch3_cmd) -		mx28_reg_32(hw_apbh_ch3_bar) -		mx28_reg_32(hw_apbh_ch3_sema) -		mx28_reg_32(hw_apbh_ch3_debug1) -		mx28_reg_32(hw_apbh_ch3_debug2) -		mx28_reg_32(hw_apbh_ch4_curcmdar) -		mx28_reg_32(hw_apbh_ch4_nxtcmdar) -		mx28_reg_32(hw_apbh_ch4_cmd) -		mx28_reg_32(hw_apbh_ch4_bar) -		mx28_reg_32(hw_apbh_ch4_sema) -		mx28_reg_32(hw_apbh_ch4_debug1) -		mx28_reg_32(hw_apbh_ch4_debug2) -		mx28_reg_32(hw_apbh_ch5_curcmdar) -		mx28_reg_32(hw_apbh_ch5_nxtcmdar) -		mx28_reg_32(hw_apbh_ch5_cmd) -		mx28_reg_32(hw_apbh_ch5_bar) -		mx28_reg_32(hw_apbh_ch5_sema) -		mx28_reg_32(hw_apbh_ch5_debug1) -		mx28_reg_32(hw_apbh_ch5_debug2) -		mx28_reg_32(hw_apbh_ch6_curcmdar) -		mx28_reg_32(hw_apbh_ch6_nxtcmdar) -		mx28_reg_32(hw_apbh_ch6_cmd) -		mx28_reg_32(hw_apbh_ch6_bar) -		mx28_reg_32(hw_apbh_ch6_sema) -		mx28_reg_32(hw_apbh_ch6_debug1) -		mx28_reg_32(hw_apbh_ch6_debug2) -		mx28_reg_32(hw_apbh_ch7_curcmdar) -		mx28_reg_32(hw_apbh_ch7_nxtcmdar) -		mx28_reg_32(hw_apbh_ch7_cmd) -		mx28_reg_32(hw_apbh_ch7_bar) -		mx28_reg_32(hw_apbh_ch7_sema) -		mx28_reg_32(hw_apbh_ch7_debug1) -		mx28_reg_32(hw_apbh_ch7_debug2) -		mx28_reg_32(hw_apbh_ch8_curcmdar) -		mx28_reg_32(hw_apbh_ch8_nxtcmdar) -		mx28_reg_32(hw_apbh_ch8_cmd) -		mx28_reg_32(hw_apbh_ch8_bar) -		mx28_reg_32(hw_apbh_ch8_sema) -		mx28_reg_32(hw_apbh_ch8_debug1) -		mx28_reg_32(hw_apbh_ch8_debug2) -		mx28_reg_32(hw_apbh_ch9_curcmdar) -		mx28_reg_32(hw_apbh_ch9_nxtcmdar) -		mx28_reg_32(hw_apbh_ch9_cmd) -		mx28_reg_32(hw_apbh_ch9_bar) -		mx28_reg_32(hw_apbh_ch9_sema) -		mx28_reg_32(hw_apbh_ch9_debug1) -		mx28_reg_32(hw_apbh_ch9_debug2) -		mx28_reg_32(hw_apbh_ch10_curcmdar) -		mx28_reg_32(hw_apbh_ch10_nxtcmdar) -		mx28_reg_32(hw_apbh_ch10_cmd) -		mx28_reg_32(hw_apbh_ch10_bar) -		mx28_reg_32(hw_apbh_ch10_sema) -		mx28_reg_32(hw_apbh_ch10_debug1) -		mx28_reg_32(hw_apbh_ch10_debug2) -		mx28_reg_32(hw_apbh_ch11_curcmdar) -		mx28_reg_32(hw_apbh_ch11_nxtcmdar) -		mx28_reg_32(hw_apbh_ch11_cmd) -		mx28_reg_32(hw_apbh_ch11_bar) -		mx28_reg_32(hw_apbh_ch11_sema) -		mx28_reg_32(hw_apbh_ch11_debug1) -		mx28_reg_32(hw_apbh_ch11_debug2) -		mx28_reg_32(hw_apbh_ch12_curcmdar) -		mx28_reg_32(hw_apbh_ch12_nxtcmdar) -		mx28_reg_32(hw_apbh_ch12_cmd) -		mx28_reg_32(hw_apbh_ch12_bar) -		mx28_reg_32(hw_apbh_ch12_sema) -		mx28_reg_32(hw_apbh_ch12_debug1) -		mx28_reg_32(hw_apbh_ch12_debug2) -		mx28_reg_32(hw_apbh_ch13_curcmdar) -		mx28_reg_32(hw_apbh_ch13_nxtcmdar) -		mx28_reg_32(hw_apbh_ch13_cmd) -		mx28_reg_32(hw_apbh_ch13_bar) -		mx28_reg_32(hw_apbh_ch13_sema) -		mx28_reg_32(hw_apbh_ch13_debug1) -		mx28_reg_32(hw_apbh_ch13_debug2) -		mx28_reg_32(hw_apbh_ch14_curcmdar) -		mx28_reg_32(hw_apbh_ch14_nxtcmdar) -		mx28_reg_32(hw_apbh_ch14_cmd) -		mx28_reg_32(hw_apbh_ch14_bar) -		mx28_reg_32(hw_apbh_ch14_sema) -		mx28_reg_32(hw_apbh_ch14_debug1) -		mx28_reg_32(hw_apbh_ch14_debug2) -		mx28_reg_32(hw_apbh_ch15_curcmdar) -		mx28_reg_32(hw_apbh_ch15_nxtcmdar) -		mx28_reg_32(hw_apbh_ch15_cmd) -		mx28_reg_32(hw_apbh_ch15_bar) -		mx28_reg_32(hw_apbh_ch15_sema) -		mx28_reg_32(hw_apbh_ch15_debug1) -		mx28_reg_32(hw_apbh_ch15_debug2) +		mxs_reg_32(hw_apbh_ch0_curcmdar) +		mxs_reg_32(hw_apbh_ch0_nxtcmdar) +		mxs_reg_32(hw_apbh_ch0_cmd) +		mxs_reg_32(hw_apbh_ch0_bar) +		mxs_reg_32(hw_apbh_ch0_sema) +		mxs_reg_32(hw_apbh_ch0_debug1) +		mxs_reg_32(hw_apbh_ch0_debug2) +		mxs_reg_32(hw_apbh_ch1_curcmdar) +		mxs_reg_32(hw_apbh_ch1_nxtcmdar) +		mxs_reg_32(hw_apbh_ch1_cmd) +		mxs_reg_32(hw_apbh_ch1_bar) +		mxs_reg_32(hw_apbh_ch1_sema) +		mxs_reg_32(hw_apbh_ch1_debug1) +		mxs_reg_32(hw_apbh_ch1_debug2) +		mxs_reg_32(hw_apbh_ch2_curcmdar) +		mxs_reg_32(hw_apbh_ch2_nxtcmdar) +		mxs_reg_32(hw_apbh_ch2_cmd) +		mxs_reg_32(hw_apbh_ch2_bar) +		mxs_reg_32(hw_apbh_ch2_sema) +		mxs_reg_32(hw_apbh_ch2_debug1) +		mxs_reg_32(hw_apbh_ch2_debug2) +		mxs_reg_32(hw_apbh_ch3_curcmdar) +		mxs_reg_32(hw_apbh_ch3_nxtcmdar) +		mxs_reg_32(hw_apbh_ch3_cmd) +		mxs_reg_32(hw_apbh_ch3_bar) +		mxs_reg_32(hw_apbh_ch3_sema) +		mxs_reg_32(hw_apbh_ch3_debug1) +		mxs_reg_32(hw_apbh_ch3_debug2) +		mxs_reg_32(hw_apbh_ch4_curcmdar) +		mxs_reg_32(hw_apbh_ch4_nxtcmdar) +		mxs_reg_32(hw_apbh_ch4_cmd) +		mxs_reg_32(hw_apbh_ch4_bar) +		mxs_reg_32(hw_apbh_ch4_sema) +		mxs_reg_32(hw_apbh_ch4_debug1) +		mxs_reg_32(hw_apbh_ch4_debug2) +		mxs_reg_32(hw_apbh_ch5_curcmdar) +		mxs_reg_32(hw_apbh_ch5_nxtcmdar) +		mxs_reg_32(hw_apbh_ch5_cmd) +		mxs_reg_32(hw_apbh_ch5_bar) +		mxs_reg_32(hw_apbh_ch5_sema) +		mxs_reg_32(hw_apbh_ch5_debug1) +		mxs_reg_32(hw_apbh_ch5_debug2) +		mxs_reg_32(hw_apbh_ch6_curcmdar) +		mxs_reg_32(hw_apbh_ch6_nxtcmdar) +		mxs_reg_32(hw_apbh_ch6_cmd) +		mxs_reg_32(hw_apbh_ch6_bar) +		mxs_reg_32(hw_apbh_ch6_sema) +		mxs_reg_32(hw_apbh_ch6_debug1) +		mxs_reg_32(hw_apbh_ch6_debug2) +		mxs_reg_32(hw_apbh_ch7_curcmdar) +		mxs_reg_32(hw_apbh_ch7_nxtcmdar) +		mxs_reg_32(hw_apbh_ch7_cmd) +		mxs_reg_32(hw_apbh_ch7_bar) +		mxs_reg_32(hw_apbh_ch7_sema) +		mxs_reg_32(hw_apbh_ch7_debug1) +		mxs_reg_32(hw_apbh_ch7_debug2) +		mxs_reg_32(hw_apbh_ch8_curcmdar) +		mxs_reg_32(hw_apbh_ch8_nxtcmdar) +		mxs_reg_32(hw_apbh_ch8_cmd) +		mxs_reg_32(hw_apbh_ch8_bar) +		mxs_reg_32(hw_apbh_ch8_sema) +		mxs_reg_32(hw_apbh_ch8_debug1) +		mxs_reg_32(hw_apbh_ch8_debug2) +		mxs_reg_32(hw_apbh_ch9_curcmdar) +		mxs_reg_32(hw_apbh_ch9_nxtcmdar) +		mxs_reg_32(hw_apbh_ch9_cmd) +		mxs_reg_32(hw_apbh_ch9_bar) +		mxs_reg_32(hw_apbh_ch9_sema) +		mxs_reg_32(hw_apbh_ch9_debug1) +		mxs_reg_32(hw_apbh_ch9_debug2) +		mxs_reg_32(hw_apbh_ch10_curcmdar) +		mxs_reg_32(hw_apbh_ch10_nxtcmdar) +		mxs_reg_32(hw_apbh_ch10_cmd) +		mxs_reg_32(hw_apbh_ch10_bar) +		mxs_reg_32(hw_apbh_ch10_sema) +		mxs_reg_32(hw_apbh_ch10_debug1) +		mxs_reg_32(hw_apbh_ch10_debug2) +		mxs_reg_32(hw_apbh_ch11_curcmdar) +		mxs_reg_32(hw_apbh_ch11_nxtcmdar) +		mxs_reg_32(hw_apbh_ch11_cmd) +		mxs_reg_32(hw_apbh_ch11_bar) +		mxs_reg_32(hw_apbh_ch11_sema) +		mxs_reg_32(hw_apbh_ch11_debug1) +		mxs_reg_32(hw_apbh_ch11_debug2) +		mxs_reg_32(hw_apbh_ch12_curcmdar) +		mxs_reg_32(hw_apbh_ch12_nxtcmdar) +		mxs_reg_32(hw_apbh_ch12_cmd) +		mxs_reg_32(hw_apbh_ch12_bar) +		mxs_reg_32(hw_apbh_ch12_sema) +		mxs_reg_32(hw_apbh_ch12_debug1) +		mxs_reg_32(hw_apbh_ch12_debug2) +		mxs_reg_32(hw_apbh_ch13_curcmdar) +		mxs_reg_32(hw_apbh_ch13_nxtcmdar) +		mxs_reg_32(hw_apbh_ch13_cmd) +		mxs_reg_32(hw_apbh_ch13_bar) +		mxs_reg_32(hw_apbh_ch13_sema) +		mxs_reg_32(hw_apbh_ch13_debug1) +		mxs_reg_32(hw_apbh_ch13_debug2) +		mxs_reg_32(hw_apbh_ch14_curcmdar) +		mxs_reg_32(hw_apbh_ch14_nxtcmdar) +		mxs_reg_32(hw_apbh_ch14_cmd) +		mxs_reg_32(hw_apbh_ch14_bar) +		mxs_reg_32(hw_apbh_ch14_sema) +		mxs_reg_32(hw_apbh_ch14_debug1) +		mxs_reg_32(hw_apbh_ch14_debug2) +		mxs_reg_32(hw_apbh_ch15_curcmdar) +		mxs_reg_32(hw_apbh_ch15_nxtcmdar) +		mxs_reg_32(hw_apbh_ch15_cmd) +		mxs_reg_32(hw_apbh_ch15_bar) +		mxs_reg_32(hw_apbh_ch15_sema) +		mxs_reg_32(hw_apbh_ch15_debug1) +		mxs_reg_32(hw_apbh_ch15_debug2)  	};  	}; -	mx28_reg_32(hw_apbh_version) +	mxs_reg_32(hw_apbh_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-base.h b/arch/arm/include/asm/arch-mxs/regs-base.h index dbdcc2b5b..dbdcc2b5b 100644 --- a/arch/arm/include/asm/arch-mx28/regs-base.h +++ b/arch/arm/include/asm/arch-mxs/regs-base.h diff --git a/arch/arm/include/asm/arch-mx28/regs-bch.h b/arch/arm/include/asm/arch-mxs/regs-bch.h index 9243bdd1c..40baa4d1f 100644 --- a/arch/arm/include/asm/arch-mx28/regs-bch.h +++ b/arch/arm/include/asm/arch-mxs/regs-bch.h @@ -29,31 +29,31 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_bch_regs { -	mx28_reg_32(hw_bch_ctrl) -	mx28_reg_32(hw_bch_status0) -	mx28_reg_32(hw_bch_mode) -	mx28_reg_32(hw_bch_encodeptr) -	mx28_reg_32(hw_bch_dataptr) -	mx28_reg_32(hw_bch_metaptr) +struct mxs_bch_regs { +	mxs_reg_32(hw_bch_ctrl) +	mxs_reg_32(hw_bch_status0) +	mxs_reg_32(hw_bch_mode) +	mxs_reg_32(hw_bch_encodeptr) +	mxs_reg_32(hw_bch_dataptr) +	mxs_reg_32(hw_bch_metaptr)  	uint32_t	reserved[4]; -	mx28_reg_32(hw_bch_layoutselect) -	mx28_reg_32(hw_bch_flash0layout0) -	mx28_reg_32(hw_bch_flash0layout1) -	mx28_reg_32(hw_bch_flash1layout0) -	mx28_reg_32(hw_bch_flash1layout1) -	mx28_reg_32(hw_bch_flash2layout0) -	mx28_reg_32(hw_bch_flash2layout1) -	mx28_reg_32(hw_bch_flash3layout0) -	mx28_reg_32(hw_bch_flash3layout1) -	mx28_reg_32(hw_bch_dbgkesread) -	mx28_reg_32(hw_bch_dbgcsferead) -	mx28_reg_32(hw_bch_dbgsyndegread) -	mx28_reg_32(hw_bch_dbgahbmread) -	mx28_reg_32(hw_bch_blockname) -	mx28_reg_32(hw_bch_version) +	mxs_reg_32(hw_bch_layoutselect) +	mxs_reg_32(hw_bch_flash0layout0) +	mxs_reg_32(hw_bch_flash0layout1) +	mxs_reg_32(hw_bch_flash1layout0) +	mxs_reg_32(hw_bch_flash1layout1) +	mxs_reg_32(hw_bch_flash2layout0) +	mxs_reg_32(hw_bch_flash2layout1) +	mxs_reg_32(hw_bch_flash3layout0) +	mxs_reg_32(hw_bch_flash3layout1) +	mxs_reg_32(hw_bch_dbgkesread) +	mxs_reg_32(hw_bch_dbgcsferead) +	mxs_reg_32(hw_bch_dbgsyndegread) +	mxs_reg_32(hw_bch_dbgahbmread) +	mxs_reg_32(hw_bch_blockname) +	mxs_reg_32(hw_bch_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-clkctrl.h b/arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h index 3c4947df2..b662fbe44 100644 --- a/arch/arm/include/asm/arch-mx28/regs-clkctrl.h +++ b/arch/arm/include/asm/arch-mxs/regs-clkctrl-mx28.h @@ -29,39 +29,39 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_clkctrl_regs { -	mx28_reg_32(hw_clkctrl_pll0ctrl0)	/* 0x00 */ -	mx28_reg_32(hw_clkctrl_pll0ctrl1)	/* 0x10 */ -	mx28_reg_32(hw_clkctrl_pll1ctrl0)	/* 0x20 */ -	mx28_reg_32(hw_clkctrl_pll1ctrl1)	/* 0x30 */ -	mx28_reg_32(hw_clkctrl_pll2ctrl0)	/* 0x40 */ -	mx28_reg_32(hw_clkctrl_cpu)		/* 0x50 */ -	mx28_reg_32(hw_clkctrl_hbus)		/* 0x60 */ -	mx28_reg_32(hw_clkctrl_xbus)		/* 0x70 */ -	mx28_reg_32(hw_clkctrl_xtal)		/* 0x80 */ -	mx28_reg_32(hw_clkctrl_ssp0)		/* 0x90 */ -	mx28_reg_32(hw_clkctrl_ssp1)		/* 0xa0 */ -	mx28_reg_32(hw_clkctrl_ssp2)		/* 0xb0 */ -	mx28_reg_32(hw_clkctrl_ssp3)		/* 0xc0 */ -	mx28_reg_32(hw_clkctrl_gpmi)		/* 0xd0 */ -	mx28_reg_32(hw_clkctrl_spdif)		/* 0xe0 */ -	mx28_reg_32(hw_clkctrl_emi)		/* 0xf0 */ -	mx28_reg_32(hw_clkctrl_saif0)		/* 0x100 */ -	mx28_reg_32(hw_clkctrl_saif1)		/* 0x110 */ -	mx28_reg_32(hw_clkctrl_lcdif)		/* 0x120 */ -	mx28_reg_32(hw_clkctrl_etm)		/* 0x130 */ -	mx28_reg_32(hw_clkctrl_enet)		/* 0x140 */ -	mx28_reg_32(hw_clkctrl_hsadc)		/* 0x150 */ -	mx28_reg_32(hw_clkctrl_flexcan)		/* 0x160 */ +struct mxs_clkctrl_regs { +	mxs_reg_32(hw_clkctrl_pll0ctrl0)	/* 0x00 */ +	mxs_reg_32(hw_clkctrl_pll0ctrl1)	/* 0x10 */ +	mxs_reg_32(hw_clkctrl_pll1ctrl0)	/* 0x20 */ +	mxs_reg_32(hw_clkctrl_pll1ctrl1)	/* 0x30 */ +	mxs_reg_32(hw_clkctrl_pll2ctrl0)	/* 0x40 */ +	mxs_reg_32(hw_clkctrl_cpu)		/* 0x50 */ +	mxs_reg_32(hw_clkctrl_hbus)		/* 0x60 */ +	mxs_reg_32(hw_clkctrl_xbus)		/* 0x70 */ +	mxs_reg_32(hw_clkctrl_xtal)		/* 0x80 */ +	mxs_reg_32(hw_clkctrl_ssp0)		/* 0x90 */ +	mxs_reg_32(hw_clkctrl_ssp1)		/* 0xa0 */ +	mxs_reg_32(hw_clkctrl_ssp2)		/* 0xb0 */ +	mxs_reg_32(hw_clkctrl_ssp3)		/* 0xc0 */ +	mxs_reg_32(hw_clkctrl_gpmi)		/* 0xd0 */ +	mxs_reg_32(hw_clkctrl_spdif)		/* 0xe0 */ +	mxs_reg_32(hw_clkctrl_emi)		/* 0xf0 */ +	mxs_reg_32(hw_clkctrl_saif0)		/* 0x100 */ +	mxs_reg_32(hw_clkctrl_saif1)		/* 0x110 */ +	mxs_reg_32(hw_clkctrl_lcdif)		/* 0x120 */ +	mxs_reg_32(hw_clkctrl_etm)		/* 0x130 */ +	mxs_reg_32(hw_clkctrl_enet)		/* 0x140 */ +	mxs_reg_32(hw_clkctrl_hsadc)		/* 0x150 */ +	mxs_reg_32(hw_clkctrl_flexcan)		/* 0x160 */  	uint32_t	reserved[16]; -	mx28_reg_8(hw_clkctrl_frac0)		/* 0x1b0 */ -	mx28_reg_8(hw_clkctrl_frac1)		/* 0x1c0 */ -	mx28_reg_32(hw_clkctrl_clkseq)		/* 0x1d0 */ -	mx28_reg_32(hw_clkctrl_reset)		/* 0x1e0 */ -	mx28_reg_32(hw_clkctrl_status)		/* 0x1f0 */ -	mx28_reg_32(hw_clkctrl_version)		/* 0x200 */ +	mxs_reg_8(hw_clkctrl_frac0)		/* 0x1b0 */ +	mxs_reg_8(hw_clkctrl_frac1)		/* 0x1c0 */ +	mxs_reg_32(hw_clkctrl_clkseq)		/* 0x1d0 */ +	mxs_reg_32(hw_clkctrl_reset)		/* 0x1e0 */ +	mxs_reg_32(hw_clkctrl_status)		/* 0x1f0 */ +	mxs_reg_32(hw_clkctrl_version)		/* 0x200 */  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-common.h b/arch/arm/include/asm/arch-mxs/regs-common.h index d2e19538a..bcea419f9 100644 --- a/arch/arm/include/asm/arch-mx28/regs-common.h +++ b/arch/arm/include/asm/arch-mxs/regs-common.h @@ -1,5 +1,5 @@  /* - * Freescale i.MX28 Register Accessors + * Freescale i.MXS Register Accessors   *   * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>   * on behalf of DENX Software Engineering GmbH @@ -20,11 +20,11 @@   *   */ -#ifndef __MX28_REGS_COMMON_H__ -#define __MX28_REGS_COMMON_H__ +#ifndef __MXS_REGS_COMMON_H__ +#define __MXS_REGS_COMMON_H__  /* - * The i.MX28 has interesting feature when it comes to register access. There + * The i.MXS has interesting feature when it comes to register access. There   * are four kinds of access to one particular register. Those are:   *   * 1) Common read/write access. To use this mode, just write to the address of @@ -47,36 +47,36 @@   *   */ -#define	__mx28_reg_8(name)		\ +#define	__mxs_reg_8(name)		\  	uint8_t	name[4];		\  	uint8_t	name##_set[4];		\  	uint8_t	name##_clr[4];		\  	uint8_t	name##_tog[4];		\ -#define	__mx28_reg_32(name)		\ +#define	__mxs_reg_32(name)		\  	uint32_t name;			\  	uint32_t name##_set;		\  	uint32_t name##_clr;		\  	uint32_t name##_tog; -struct mx28_register_8 { -	__mx28_reg_8(reg) +struct mxs_register_8 { +	__mxs_reg_8(reg)  }; -struct mx28_register_32 { -	__mx28_reg_32(reg) +struct mxs_register_32 { +	__mxs_reg_32(reg)  }; -#define	mx28_reg_8(name)				\ +#define	mxs_reg_8(name)				\  	union {						\ -		struct { __mx28_reg_8(name) };		\ -		struct mx28_register_8 name##_reg;	\ +		struct { __mxs_reg_8(name) };		\ +		struct mxs_register_8 name##_reg;	\  	}; -#define	mx28_reg_32(name)				\ +#define	mxs_reg_32(name)				\  	union {						\ -		struct { __mx28_reg_32(name) };		\ -		struct mx28_register_32 name##_reg;	\ +		struct { __mxs_reg_32(name) };		\ +		struct mxs_register_32 name##_reg;	\  	}; -#endif	/* __MX28_REGS_COMMON_H__ */ +#endif	/* __MXS_REGS_COMMON_H__ */ diff --git a/arch/arm/include/asm/arch-mx28/regs-digctl.h b/arch/arm/include/asm/arch-mxs/regs-digctl.h index 9a63594d0..e7cc4b45d 100644 --- a/arch/arm/include/asm/arch-mx28/regs-digctl.h +++ b/arch/arm/include/asm/arch-mxs/regs-digctl.h @@ -25,17 +25,17 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_digctl_regs { -	mx28_reg_32(hw_digctl_ctrl)				/* 0x000 */ -	mx28_reg_32(hw_digctl_status)				/* 0x010 */ -	mx28_reg_32(hw_digctl_hclkcount)			/* 0x020 */ -	mx28_reg_32(hw_digctl_ramctrl)				/* 0x030 */ -	mx28_reg_32(hw_digctl_emi_status)			/* 0x040 */ -	mx28_reg_32(hw_digctl_read_margin)			/* 0x050 */ +struct mxs_digctl_regs { +	mxs_reg_32(hw_digctl_ctrl)				/* 0x000 */ +	mxs_reg_32(hw_digctl_status)				/* 0x010 */ +	mxs_reg_32(hw_digctl_hclkcount)			/* 0x020 */ +	mxs_reg_32(hw_digctl_ramctrl)				/* 0x030 */ +	mxs_reg_32(hw_digctl_emi_status)			/* 0x040 */ +	mxs_reg_32(hw_digctl_read_margin)			/* 0x050 */  	uint32_t	hw_digctl_writeonce;			/* 0x060 */  	uint32_t	reserved_writeonce[3]; -	mx28_reg_32(hw_digctl_bist_ctl)				/* 0x070 */ -	mx28_reg_32(hw_digctl_bist_status)			/* 0x080 */ +	mxs_reg_32(hw_digctl_bist_ctl)				/* 0x070 */ +	mxs_reg_32(hw_digctl_bist_status)			/* 0x080 */  	uint32_t	hw_digctl_entropy;			/* 0x090 */  	uint32_t	reserved_entropy[3];  	uint32_t	hw_digctl_entropy_latched;		/* 0x0a0 */ @@ -43,7 +43,7 @@ struct mx28_digctl_regs {  	uint32_t	reserved1[4]; -	mx28_reg_32(hw_digctl_microseconds)			/* 0x0c0 */ +	mxs_reg_32(hw_digctl_microseconds)			/* 0x0c0 */  	uint32_t	hw_digctl_dbgrd;			/* 0x0d0 */  	uint32_t	reserved_hw_digctl_dbgrd[3];  	uint32_t	hw_digctl_dbg;				/* 0x0e0 */ @@ -51,21 +51,21 @@ struct mx28_digctl_regs {  	uint32_t	reserved2[4]; -	mx28_reg_32(hw_digctl_usb_loopback)			/* 0x100 */ -	mx28_reg_32(hw_digctl_ocram_status0)			/* 0x110 */ -	mx28_reg_32(hw_digctl_ocram_status1)			/* 0x120 */ -	mx28_reg_32(hw_digctl_ocram_status2)			/* 0x130 */ -	mx28_reg_32(hw_digctl_ocram_status3)			/* 0x140 */ -	mx28_reg_32(hw_digctl_ocram_status4)			/* 0x150 */ -	mx28_reg_32(hw_digctl_ocram_status5)			/* 0x160 */ -	mx28_reg_32(hw_digctl_ocram_status6)			/* 0x170 */ -	mx28_reg_32(hw_digctl_ocram_status7)			/* 0x180 */ -	mx28_reg_32(hw_digctl_ocram_status8)			/* 0x190 */ -	mx28_reg_32(hw_digctl_ocram_status9)			/* 0x1a0 */ -	mx28_reg_32(hw_digctl_ocram_status10)			/* 0x1b0 */ -	mx28_reg_32(hw_digctl_ocram_status11)			/* 0x1c0 */ -	mx28_reg_32(hw_digctl_ocram_status12)			/* 0x1d0 */ -	mx28_reg_32(hw_digctl_ocram_status13)			/* 0x1e0 */ +	mxs_reg_32(hw_digctl_usb_loopback)			/* 0x100 */ +	mxs_reg_32(hw_digctl_ocram_status0)			/* 0x110 */ +	mxs_reg_32(hw_digctl_ocram_status1)			/* 0x120 */ +	mxs_reg_32(hw_digctl_ocram_status2)			/* 0x130 */ +	mxs_reg_32(hw_digctl_ocram_status3)			/* 0x140 */ +	mxs_reg_32(hw_digctl_ocram_status4)			/* 0x150 */ +	mxs_reg_32(hw_digctl_ocram_status5)			/* 0x160 */ +	mxs_reg_32(hw_digctl_ocram_status6)			/* 0x170 */ +	mxs_reg_32(hw_digctl_ocram_status7)			/* 0x180 */ +	mxs_reg_32(hw_digctl_ocram_status8)			/* 0x190 */ +	mxs_reg_32(hw_digctl_ocram_status9)			/* 0x1a0 */ +	mxs_reg_32(hw_digctl_ocram_status10)			/* 0x1b0 */ +	mxs_reg_32(hw_digctl_ocram_status11)			/* 0x1c0 */ +	mxs_reg_32(hw_digctl_ocram_status12)			/* 0x1d0 */ +	mxs_reg_32(hw_digctl_ocram_status13)			/* 0x1e0 */  	uint32_t	reserved3[36]; @@ -75,7 +75,7 @@ struct mx28_digctl_regs {  	uint32_t	reserved_hw_digctl_scratch1[3];  	uint32_t	hw_digctl_armcache;			/* 0x2a0 */  	uint32_t	reserved_hw_digctl_armcache[3]; -	mx28_reg_32(hw_digctl_debug_trap)			/* 0x2b0 */ +	mxs_reg_32(hw_digctl_debug_trap)			/* 0x2b0 */  	uint32_t	hw_digctl_debug_trap_l0_addr_low;	/* 0x2c0 */  	uint32_t	reserved_hw_digctl_debug_trap_l0_addr_low[3];  	uint32_t	hw_digctl_debug_trap_l0_addr_high;	/* 0x2d0 */ @@ -152,4 +152,8 @@ struct mx28_digctl_regs {  };  #endif +/* Product code identification */ +#define HW_DIGCTL_CHIPID_MASK	(0xffff << 16) +#define HW_DIGCTL_CHIPID_MX28	(0x2800 << 16) +  #endif /* __MX28_REGS_DIGCTL_H__ */ diff --git a/arch/arm/include/asm/arch-mx28/regs-gpmi.h b/arch/arm/include/asm/arch-mxs/regs-gpmi.h index 1b487f46c..624d61856 100644 --- a/arch/arm/include/asm/arch-mx28/regs-gpmi.h +++ b/arch/arm/include/asm/arch-mxs/regs-gpmi.h @@ -29,23 +29,23 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_gpmi_regs { -	mx28_reg_32(hw_gpmi_ctrl0) -	mx28_reg_32(hw_gpmi_compare) -	mx28_reg_32(hw_gpmi_eccctrl) -	mx28_reg_32(hw_gpmi_ecccount) -	mx28_reg_32(hw_gpmi_payload) -	mx28_reg_32(hw_gpmi_auxiliary) -	mx28_reg_32(hw_gpmi_ctrl1) -	mx28_reg_32(hw_gpmi_timing0) -	mx28_reg_32(hw_gpmi_timing1) +struct mxs_gpmi_regs { +	mxs_reg_32(hw_gpmi_ctrl0) +	mxs_reg_32(hw_gpmi_compare) +	mxs_reg_32(hw_gpmi_eccctrl) +	mxs_reg_32(hw_gpmi_ecccount) +	mxs_reg_32(hw_gpmi_payload) +	mxs_reg_32(hw_gpmi_auxiliary) +	mxs_reg_32(hw_gpmi_ctrl1) +	mxs_reg_32(hw_gpmi_timing0) +	mxs_reg_32(hw_gpmi_timing1)  	uint32_t	reserved[4]; -	mx28_reg_32(hw_gpmi_data) -	mx28_reg_32(hw_gpmi_stat) -	mx28_reg_32(hw_gpmi_debug) -	mx28_reg_32(hw_gpmi_version) +	mxs_reg_32(hw_gpmi_data) +	mxs_reg_32(hw_gpmi_stat) +	mxs_reg_32(hw_gpmi_debug) +	mxs_reg_32(hw_gpmi_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-i2c.h b/arch/arm/include/asm/arch-mxs/regs-i2c.h index 2e2e81453..067cfd394 100644 --- a/arch/arm/include/asm/arch-mx28/regs-i2c.h +++ b/arch/arm/include/asm/arch-mxs/regs-i2c.h @@ -26,21 +26,21 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_i2c_regs { -	mx28_reg_32(hw_i2c_ctrl0) -	mx28_reg_32(hw_i2c_timing0) -	mx28_reg_32(hw_i2c_timing1) -	mx28_reg_32(hw_i2c_timing2) -	mx28_reg_32(hw_i2c_ctrl1) -	mx28_reg_32(hw_i2c_stat) -	mx28_reg_32(hw_i2c_queuectrl) -	mx28_reg_32(hw_i2c_queuestat) -	mx28_reg_32(hw_i2c_queuecmd) -	mx28_reg_32(hw_i2c_queuedata) -	mx28_reg_32(hw_i2c_data) -	mx28_reg_32(hw_i2c_debug0) -	mx28_reg_32(hw_i2c_debug1) -	mx28_reg_32(hw_i2c_version) +struct mxs_i2c_regs { +	mxs_reg_32(hw_i2c_ctrl0) +	mxs_reg_32(hw_i2c_timing0) +	mxs_reg_32(hw_i2c_timing1) +	mxs_reg_32(hw_i2c_timing2) +	mxs_reg_32(hw_i2c_ctrl1) +	mxs_reg_32(hw_i2c_stat) +	mxs_reg_32(hw_i2c_queuectrl) +	mxs_reg_32(hw_i2c_queuestat) +	mxs_reg_32(hw_i2c_queuecmd) +	mxs_reg_32(hw_i2c_queuedata) +	mxs_reg_32(hw_i2c_data) +	mxs_reg_32(hw_i2c_debug0) +	mxs_reg_32(hw_i2c_debug1) +	mxs_reg_32(hw_i2c_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-lcdif.h b/arch/arm/include/asm/arch-mxs/regs-lcdif.h index cb47e41fd..b90b2d437 100644 --- a/arch/arm/include/asm/arch-mx28/regs-lcdif.h +++ b/arch/arm/include/asm/arch-mxs/regs-lcdif.h @@ -29,39 +29,39 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_lcdif_regs { -	mx28_reg_32(hw_lcdif_ctrl)		/* 0x00 */ -	mx28_reg_32(hw_lcdif_ctrl1)		/* 0x10 */ -	mx28_reg_32(hw_lcdif_ctrl2)		/* 0x20 */ -	mx28_reg_32(hw_lcdif_transfer_count)	/* 0x30 */ -	mx28_reg_32(hw_lcdif_cur_buf)		/* 0x40 */ -	mx28_reg_32(hw_lcdif_next_buf)		/* 0x50 */ -	mx28_reg_32(hw_lcdif_timing)		/* 0x60 */ -	mx28_reg_32(hw_lcdif_vdctrl0)		/* 0x70 */ -	mx28_reg_32(hw_lcdif_vdctrl1)		/* 0x80 */ -	mx28_reg_32(hw_lcdif_vdctrl2)		/* 0x90 */ -	mx28_reg_32(hw_lcdif_vdctrl3)		/* 0xa0 */ -	mx28_reg_32(hw_lcdif_vdctrl4)		/* 0xb0 */ -	mx28_reg_32(hw_lcdif_dvictrl0)		/* 0xc0 */ -	mx28_reg_32(hw_lcdif_dvictrl1)		/* 0xd0 */ -	mx28_reg_32(hw_lcdif_dvictrl2)		/* 0xe0 */ -	mx28_reg_32(hw_lcdif_dvictrl3)		/* 0xf0 */ -	mx28_reg_32(hw_lcdif_dvictrl4)		/* 0x100 */ -	mx28_reg_32(hw_lcdif_csc_coeffctrl0)	/* 0x110 */ -	mx28_reg_32(hw_lcdif_csc_coeffctrl1)	/* 0x120 */ -	mx28_reg_32(hw_lcdif_csc_coeffctrl2)	/* 0x130 */ -	mx28_reg_32(hw_lcdif_csc_coeffctrl3)	/* 0x140 */ -	mx28_reg_32(hw_lcdif_csc_coeffctrl4)	/* 0x150 */ -	mx28_reg_32(hw_lcdif_csc_offset)	/* 0x160 */ -	mx28_reg_32(hw_lcdif_csc_limit)		/* 0x170 */ -	mx28_reg_32(hw_lcdif_data)		/* 0x180 */ -	mx28_reg_32(hw_lcdif_bm_error_stat)	/* 0x190 */ -	mx28_reg_32(hw_lcdif_crc_stat)		/* 0x1a0 */ -	mx28_reg_32(hw_lcdif_lcdif_stat)	/* 0x1b0 */ -	mx28_reg_32(hw_lcdif_version)		/* 0x1c0 */ -	mx28_reg_32(hw_lcdif_debug0)		/* 0x1d0 */ -	mx28_reg_32(hw_lcdif_debug1)		/* 0x1e0 */ -	mx28_reg_32(hw_lcdif_debug2)		/* 0x1f0 */ +struct mxs_lcdif_regs { +	mxs_reg_32(hw_lcdif_ctrl)		/* 0x00 */ +	mxs_reg_32(hw_lcdif_ctrl1)		/* 0x10 */ +	mxs_reg_32(hw_lcdif_ctrl2)		/* 0x20 */ +	mxs_reg_32(hw_lcdif_transfer_count)	/* 0x30 */ +	mxs_reg_32(hw_lcdif_cur_buf)		/* 0x40 */ +	mxs_reg_32(hw_lcdif_next_buf)		/* 0x50 */ +	mxs_reg_32(hw_lcdif_timing)		/* 0x60 */ +	mxs_reg_32(hw_lcdif_vdctrl0)		/* 0x70 */ +	mxs_reg_32(hw_lcdif_vdctrl1)		/* 0x80 */ +	mxs_reg_32(hw_lcdif_vdctrl2)		/* 0x90 */ +	mxs_reg_32(hw_lcdif_vdctrl3)		/* 0xa0 */ +	mxs_reg_32(hw_lcdif_vdctrl4)		/* 0xb0 */ +	mxs_reg_32(hw_lcdif_dvictrl0)		/* 0xc0 */ +	mxs_reg_32(hw_lcdif_dvictrl1)		/* 0xd0 */ +	mxs_reg_32(hw_lcdif_dvictrl2)		/* 0xe0 */ +	mxs_reg_32(hw_lcdif_dvictrl3)		/* 0xf0 */ +	mxs_reg_32(hw_lcdif_dvictrl4)		/* 0x100 */ +	mxs_reg_32(hw_lcdif_csc_coeffctrl0)	/* 0x110 */ +	mxs_reg_32(hw_lcdif_csc_coeffctrl1)	/* 0x120 */ +	mxs_reg_32(hw_lcdif_csc_coeffctrl2)	/* 0x130 */ +	mxs_reg_32(hw_lcdif_csc_coeffctrl3)	/* 0x140 */ +	mxs_reg_32(hw_lcdif_csc_coeffctrl4)	/* 0x150 */ +	mxs_reg_32(hw_lcdif_csc_offset)	/* 0x160 */ +	mxs_reg_32(hw_lcdif_csc_limit)		/* 0x170 */ +	mxs_reg_32(hw_lcdif_data)		/* 0x180 */ +	mxs_reg_32(hw_lcdif_bm_error_stat)	/* 0x190 */ +	mxs_reg_32(hw_lcdif_crc_stat)		/* 0x1a0 */ +	mxs_reg_32(hw_lcdif_lcdif_stat)	/* 0x1b0 */ +	mxs_reg_32(hw_lcdif_version)		/* 0x1c0 */ +	mxs_reg_32(hw_lcdif_debug0)		/* 0x1d0 */ +	mxs_reg_32(hw_lcdif_debug1)		/* 0x1e0 */ +	mxs_reg_32(hw_lcdif_debug2)		/* 0x1f0 */  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-lradc.h b/arch/arm/include/asm/arch-mxs/regs-lradc.h index 16e2bbf4c..28d838242 100644 --- a/arch/arm/include/asm/arch-mx28/regs-lradc.h +++ b/arch/arm/include/asm/arch-mxs/regs-lradc.h @@ -29,31 +29,31 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_lradc_regs { -	mx28_reg_32(hw_lradc_ctrl0); -	mx28_reg_32(hw_lradc_ctrl1); -	mx28_reg_32(hw_lradc_ctrl2); -	mx28_reg_32(hw_lradc_ctrl3); -	mx28_reg_32(hw_lradc_status); -	mx28_reg_32(hw_lradc_ch0); -	mx28_reg_32(hw_lradc_ch1); -	mx28_reg_32(hw_lradc_ch2); -	mx28_reg_32(hw_lradc_ch3); -	mx28_reg_32(hw_lradc_ch4); -	mx28_reg_32(hw_lradc_ch5); -	mx28_reg_32(hw_lradc_ch6); -	mx28_reg_32(hw_lradc_ch7); -	mx28_reg_32(hw_lradc_delay0); -	mx28_reg_32(hw_lradc_delay1); -	mx28_reg_32(hw_lradc_delay2); -	mx28_reg_32(hw_lradc_delay3); -	mx28_reg_32(hw_lradc_debug0); -	mx28_reg_32(hw_lradc_debug1); -	mx28_reg_32(hw_lradc_conversion); -	mx28_reg_32(hw_lradc_ctrl4); -	mx28_reg_32(hw_lradc_treshold0); -	mx28_reg_32(hw_lradc_treshold1); -	mx28_reg_32(hw_lradc_version); +struct mxs_lradc_regs { +	mxs_reg_32(hw_lradc_ctrl0); +	mxs_reg_32(hw_lradc_ctrl1); +	mxs_reg_32(hw_lradc_ctrl2); +	mxs_reg_32(hw_lradc_ctrl3); +	mxs_reg_32(hw_lradc_status); +	mxs_reg_32(hw_lradc_ch0); +	mxs_reg_32(hw_lradc_ch1); +	mxs_reg_32(hw_lradc_ch2); +	mxs_reg_32(hw_lradc_ch3); +	mxs_reg_32(hw_lradc_ch4); +	mxs_reg_32(hw_lradc_ch5); +	mxs_reg_32(hw_lradc_ch6); +	mxs_reg_32(hw_lradc_ch7); +	mxs_reg_32(hw_lradc_delay0); +	mxs_reg_32(hw_lradc_delay1); +	mxs_reg_32(hw_lradc_delay2); +	mxs_reg_32(hw_lradc_delay3); +	mxs_reg_32(hw_lradc_debug0); +	mxs_reg_32(hw_lradc_debug1); +	mxs_reg_32(hw_lradc_conversion); +	mxs_reg_32(hw_lradc_ctrl4); +	mxs_reg_32(hw_lradc_treshold0); +	mxs_reg_32(hw_lradc_treshold1); +	mxs_reg_32(hw_lradc_version);  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-ocotp.h b/arch/arm/include/asm/arch-mxs/regs-ocotp.h index 273803551..3269892f9 100644 --- a/arch/arm/include/asm/arch-mx28/regs-ocotp.h +++ b/arch/arm/include/asm/arch-mxs/regs-ocotp.h @@ -29,50 +29,50 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_ocotp_regs { -	mx28_reg_32(hw_ocotp_ctrl)	/* 0x0 */ -	mx28_reg_32(hw_ocotp_data)	/* 0x10 */ -	mx28_reg_32(hw_ocotp_cust0)	/* 0x20 */ -	mx28_reg_32(hw_ocotp_cust1)	/* 0x30 */ -	mx28_reg_32(hw_ocotp_cust2)	/* 0x40 */ -	mx28_reg_32(hw_ocotp_cust3)	/* 0x50 */ -	mx28_reg_32(hw_ocotp_crypto0)	/* 0x60 */ -	mx28_reg_32(hw_ocotp_crypto1)	/* 0x70 */ -	mx28_reg_32(hw_ocotp_crypto2)	/* 0x80 */ -	mx28_reg_32(hw_ocotp_crypto3)	/* 0x90 */ -	mx28_reg_32(hw_ocotp_hwcap0)	/* 0xa0 */ -	mx28_reg_32(hw_ocotp_hwcap1)	/* 0xb0 */ -	mx28_reg_32(hw_ocotp_hwcap2)	/* 0xc0 */ -	mx28_reg_32(hw_ocotp_hwcap3)	/* 0xd0 */ -	mx28_reg_32(hw_ocotp_hwcap4)	/* 0xe0 */ -	mx28_reg_32(hw_ocotp_hwcap5)	/* 0xf0 */ -	mx28_reg_32(hw_ocotp_swcap)	/* 0x100 */ -	mx28_reg_32(hw_ocotp_custcap)	/* 0x110 */ -	mx28_reg_32(hw_ocotp_lock)	/* 0x120 */ -	mx28_reg_32(hw_ocotp_ops0)	/* 0x130 */ -	mx28_reg_32(hw_ocotp_ops1)	/* 0x140 */ -	mx28_reg_32(hw_ocotp_ops2)	/* 0x150 */ -	mx28_reg_32(hw_ocotp_ops3)	/* 0x160 */ -	mx28_reg_32(hw_ocotp_un0)	/* 0x170 */ -	mx28_reg_32(hw_ocotp_un1)	/* 0x180 */ -	mx28_reg_32(hw_ocotp_un2)	/* 0x190 */ -	mx28_reg_32(hw_ocotp_rom0)	/* 0x1a0 */ -	mx28_reg_32(hw_ocotp_rom1)	/* 0x1b0 */ -	mx28_reg_32(hw_ocotp_rom2)	/* 0x1c0 */ -	mx28_reg_32(hw_ocotp_rom3)	/* 0x1d0 */ -	mx28_reg_32(hw_ocotp_rom4)	/* 0x1e0 */ -	mx28_reg_32(hw_ocotp_rom5)	/* 0x1f0 */ -	mx28_reg_32(hw_ocotp_rom6)	/* 0x200 */ -	mx28_reg_32(hw_ocotp_rom7)	/* 0x210 */ -	mx28_reg_32(hw_ocotp_srk0)	/* 0x220 */ -	mx28_reg_32(hw_ocotp_srk1)	/* 0x230 */ -	mx28_reg_32(hw_ocotp_srk2)	/* 0x240 */ -	mx28_reg_32(hw_ocotp_srk3)	/* 0x250 */ -	mx28_reg_32(hw_ocotp_srk4)	/* 0x260 */ -	mx28_reg_32(hw_ocotp_srk5)	/* 0x270 */ -	mx28_reg_32(hw_ocotp_srk6)	/* 0x280 */ -	mx28_reg_32(hw_ocotp_srk7)	/* 0x290 */ -	mx28_reg_32(hw_ocotp_version)	/* 0x2a0 */ +struct mxs_ocotp_regs { +	mxs_reg_32(hw_ocotp_ctrl)	/* 0x0 */ +	mxs_reg_32(hw_ocotp_data)	/* 0x10 */ +	mxs_reg_32(hw_ocotp_cust0)	/* 0x20 */ +	mxs_reg_32(hw_ocotp_cust1)	/* 0x30 */ +	mxs_reg_32(hw_ocotp_cust2)	/* 0x40 */ +	mxs_reg_32(hw_ocotp_cust3)	/* 0x50 */ +	mxs_reg_32(hw_ocotp_crypto0)	/* 0x60 */ +	mxs_reg_32(hw_ocotp_crypto1)	/* 0x70 */ +	mxs_reg_32(hw_ocotp_crypto2)	/* 0x80 */ +	mxs_reg_32(hw_ocotp_crypto3)	/* 0x90 */ +	mxs_reg_32(hw_ocotp_hwcap0)	/* 0xa0 */ +	mxs_reg_32(hw_ocotp_hwcap1)	/* 0xb0 */ +	mxs_reg_32(hw_ocotp_hwcap2)	/* 0xc0 */ +	mxs_reg_32(hw_ocotp_hwcap3)	/* 0xd0 */ +	mxs_reg_32(hw_ocotp_hwcap4)	/* 0xe0 */ +	mxs_reg_32(hw_ocotp_hwcap5)	/* 0xf0 */ +	mxs_reg_32(hw_ocotp_swcap)	/* 0x100 */ +	mxs_reg_32(hw_ocotp_custcap)	/* 0x110 */ +	mxs_reg_32(hw_ocotp_lock)	/* 0x120 */ +	mxs_reg_32(hw_ocotp_ops0)	/* 0x130 */ +	mxs_reg_32(hw_ocotp_ops1)	/* 0x140 */ +	mxs_reg_32(hw_ocotp_ops2)	/* 0x150 */ +	mxs_reg_32(hw_ocotp_ops3)	/* 0x160 */ +	mxs_reg_32(hw_ocotp_un0)	/* 0x170 */ +	mxs_reg_32(hw_ocotp_un1)	/* 0x180 */ +	mxs_reg_32(hw_ocotp_un2)	/* 0x190 */ +	mxs_reg_32(hw_ocotp_rom0)	/* 0x1a0 */ +	mxs_reg_32(hw_ocotp_rom1)	/* 0x1b0 */ +	mxs_reg_32(hw_ocotp_rom2)	/* 0x1c0 */ +	mxs_reg_32(hw_ocotp_rom3)	/* 0x1d0 */ +	mxs_reg_32(hw_ocotp_rom4)	/* 0x1e0 */ +	mxs_reg_32(hw_ocotp_rom5)	/* 0x1f0 */ +	mxs_reg_32(hw_ocotp_rom6)	/* 0x200 */ +	mxs_reg_32(hw_ocotp_rom7)	/* 0x210 */ +	mxs_reg_32(hw_ocotp_srk0)	/* 0x220 */ +	mxs_reg_32(hw_ocotp_srk1)	/* 0x230 */ +	mxs_reg_32(hw_ocotp_srk2)	/* 0x240 */ +	mxs_reg_32(hw_ocotp_srk3)	/* 0x250 */ +	mxs_reg_32(hw_ocotp_srk4)	/* 0x260 */ +	mxs_reg_32(hw_ocotp_srk5)	/* 0x270 */ +	mxs_reg_32(hw_ocotp_srk6)	/* 0x280 */ +	mxs_reg_32(hw_ocotp_srk7)	/* 0x290 */ +	mxs_reg_32(hw_ocotp_version)	/* 0x2a0 */  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-pinctrl.h b/arch/arm/include/asm/arch-mxs/regs-pinctrl.h index 80dcdf661..d5841709c 100644 --- a/arch/arm/include/asm/arch-mx28/regs-pinctrl.h +++ b/arch/arm/include/asm/arch-mxs/regs-pinctrl.h @@ -29,130 +29,130 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_pinctrl_regs { -	mx28_reg_32(hw_pinctrl_ctrl)		/* 0x0 */ +struct mxs_pinctrl_regs { +	mxs_reg_32(hw_pinctrl_ctrl)		/* 0x0 */  	uint32_t	reserved1[60]; -	mx28_reg_32(hw_pinctrl_muxsel0)		/* 0x100 */ -	mx28_reg_32(hw_pinctrl_muxsel1)		/* 0x110 */ -	mx28_reg_32(hw_pinctrl_muxsel2)		/* 0x120 */ -	mx28_reg_32(hw_pinctrl_muxsel3)		/* 0x130 */ -	mx28_reg_32(hw_pinctrl_muxsel4)		/* 0x140 */ -	mx28_reg_32(hw_pinctrl_muxsel5)		/* 0x150 */ -	mx28_reg_32(hw_pinctrl_muxsel6)		/* 0x160 */ -	mx28_reg_32(hw_pinctrl_muxsel7)		/* 0x170 */ -	mx28_reg_32(hw_pinctrl_muxsel8)		/* 0x180 */ -	mx28_reg_32(hw_pinctrl_muxsel9)		/* 0x190 */ -	mx28_reg_32(hw_pinctrl_muxsel10)	/* 0x1a0 */ -	mx28_reg_32(hw_pinctrl_muxsel11)	/* 0x1b0 */ -	mx28_reg_32(hw_pinctrl_muxsel12)	/* 0x1c0 */ -	mx28_reg_32(hw_pinctrl_muxsel13)	/* 0x1d0 */ +	mxs_reg_32(hw_pinctrl_muxsel0)		/* 0x100 */ +	mxs_reg_32(hw_pinctrl_muxsel1)		/* 0x110 */ +	mxs_reg_32(hw_pinctrl_muxsel2)		/* 0x120 */ +	mxs_reg_32(hw_pinctrl_muxsel3)		/* 0x130 */ +	mxs_reg_32(hw_pinctrl_muxsel4)		/* 0x140 */ +	mxs_reg_32(hw_pinctrl_muxsel5)		/* 0x150 */ +	mxs_reg_32(hw_pinctrl_muxsel6)		/* 0x160 */ +	mxs_reg_32(hw_pinctrl_muxsel7)		/* 0x170 */ +	mxs_reg_32(hw_pinctrl_muxsel8)		/* 0x180 */ +	mxs_reg_32(hw_pinctrl_muxsel9)		/* 0x190 */ +	mxs_reg_32(hw_pinctrl_muxsel10)	/* 0x1a0 */ +	mxs_reg_32(hw_pinctrl_muxsel11)	/* 0x1b0 */ +	mxs_reg_32(hw_pinctrl_muxsel12)	/* 0x1c0 */ +	mxs_reg_32(hw_pinctrl_muxsel13)	/* 0x1d0 */  	uint32_t	reserved2[72]; -	mx28_reg_32(hw_pinctrl_drive0)		/* 0x300 */ -	mx28_reg_32(hw_pinctrl_drive1)		/* 0x310 */ -	mx28_reg_32(hw_pinctrl_drive2)		/* 0x320 */ -	mx28_reg_32(hw_pinctrl_drive3)		/* 0x330 */ -	mx28_reg_32(hw_pinctrl_drive4)		/* 0x340 */ -	mx28_reg_32(hw_pinctrl_drive5)		/* 0x350 */ -	mx28_reg_32(hw_pinctrl_drive6)		/* 0x360 */ -	mx28_reg_32(hw_pinctrl_drive7)		/* 0x370 */ -	mx28_reg_32(hw_pinctrl_drive8)		/* 0x380 */ -	mx28_reg_32(hw_pinctrl_drive9)		/* 0x390 */ -	mx28_reg_32(hw_pinctrl_drive10)		/* 0x3a0 */ -	mx28_reg_32(hw_pinctrl_drive11)		/* 0x3b0 */ -	mx28_reg_32(hw_pinctrl_drive12)		/* 0x3c0 */ -	mx28_reg_32(hw_pinctrl_drive13)		/* 0x3d0 */ -	mx28_reg_32(hw_pinctrl_drive14)		/* 0x3e0 */ -	mx28_reg_32(hw_pinctrl_drive15)		/* 0x3f0 */ -	mx28_reg_32(hw_pinctrl_drive16)		/* 0x400 */ -	mx28_reg_32(hw_pinctrl_drive17)		/* 0x410 */ -	mx28_reg_32(hw_pinctrl_drive18)		/* 0x420 */ -	mx28_reg_32(hw_pinctrl_drive19)		/* 0x430 */ +	mxs_reg_32(hw_pinctrl_drive0)		/* 0x300 */ +	mxs_reg_32(hw_pinctrl_drive1)		/* 0x310 */ +	mxs_reg_32(hw_pinctrl_drive2)		/* 0x320 */ +	mxs_reg_32(hw_pinctrl_drive3)		/* 0x330 */ +	mxs_reg_32(hw_pinctrl_drive4)		/* 0x340 */ +	mxs_reg_32(hw_pinctrl_drive5)		/* 0x350 */ +	mxs_reg_32(hw_pinctrl_drive6)		/* 0x360 */ +	mxs_reg_32(hw_pinctrl_drive7)		/* 0x370 */ +	mxs_reg_32(hw_pinctrl_drive8)		/* 0x380 */ +	mxs_reg_32(hw_pinctrl_drive9)		/* 0x390 */ +	mxs_reg_32(hw_pinctrl_drive10)		/* 0x3a0 */ +	mxs_reg_32(hw_pinctrl_drive11)		/* 0x3b0 */ +	mxs_reg_32(hw_pinctrl_drive12)		/* 0x3c0 */ +	mxs_reg_32(hw_pinctrl_drive13)		/* 0x3d0 */ +	mxs_reg_32(hw_pinctrl_drive14)		/* 0x3e0 */ +	mxs_reg_32(hw_pinctrl_drive15)		/* 0x3f0 */ +	mxs_reg_32(hw_pinctrl_drive16)		/* 0x400 */ +	mxs_reg_32(hw_pinctrl_drive17)		/* 0x410 */ +	mxs_reg_32(hw_pinctrl_drive18)		/* 0x420 */ +	mxs_reg_32(hw_pinctrl_drive19)		/* 0x430 */  	uint32_t	reserved3[112]; -	mx28_reg_32(hw_pinctrl_pull0)		/* 0x600 */ -	mx28_reg_32(hw_pinctrl_pull1)		/* 0x610 */ -	mx28_reg_32(hw_pinctrl_pull2)		/* 0x620 */ -	mx28_reg_32(hw_pinctrl_pull3)		/* 0x630 */ -	mx28_reg_32(hw_pinctrl_pull4)		/* 0x640 */ -	mx28_reg_32(hw_pinctrl_pull5)		/* 0x650 */ -	mx28_reg_32(hw_pinctrl_pull6)		/* 0x660 */ +	mxs_reg_32(hw_pinctrl_pull0)		/* 0x600 */ +	mxs_reg_32(hw_pinctrl_pull1)		/* 0x610 */ +	mxs_reg_32(hw_pinctrl_pull2)		/* 0x620 */ +	mxs_reg_32(hw_pinctrl_pull3)		/* 0x630 */ +	mxs_reg_32(hw_pinctrl_pull4)		/* 0x640 */ +	mxs_reg_32(hw_pinctrl_pull5)		/* 0x650 */ +	mxs_reg_32(hw_pinctrl_pull6)		/* 0x660 */  	uint32_t	reserved4[36]; -	mx28_reg_32(hw_pinctrl_dout0)		/* 0x700 */ -	mx28_reg_32(hw_pinctrl_dout1)		/* 0x710 */ -	mx28_reg_32(hw_pinctrl_dout2)		/* 0x720 */ -	mx28_reg_32(hw_pinctrl_dout3)		/* 0x730 */ -	mx28_reg_32(hw_pinctrl_dout4)		/* 0x740 */ +	mxs_reg_32(hw_pinctrl_dout0)		/* 0x700 */ +	mxs_reg_32(hw_pinctrl_dout1)		/* 0x710 */ +	mxs_reg_32(hw_pinctrl_dout2)		/* 0x720 */ +	mxs_reg_32(hw_pinctrl_dout3)		/* 0x730 */ +	mxs_reg_32(hw_pinctrl_dout4)		/* 0x740 */  	uint32_t	reserved5[108]; -	mx28_reg_32(hw_pinctrl_din0)		/* 0x900 */ -	mx28_reg_32(hw_pinctrl_din1)		/* 0x910 */ -	mx28_reg_32(hw_pinctrl_din2)		/* 0x920 */ -	mx28_reg_32(hw_pinctrl_din3)		/* 0x930 */ -	mx28_reg_32(hw_pinctrl_din4)		/* 0x940 */ +	mxs_reg_32(hw_pinctrl_din0)		/* 0x900 */ +	mxs_reg_32(hw_pinctrl_din1)		/* 0x910 */ +	mxs_reg_32(hw_pinctrl_din2)		/* 0x920 */ +	mxs_reg_32(hw_pinctrl_din3)		/* 0x930 */ +	mxs_reg_32(hw_pinctrl_din4)		/* 0x940 */  	uint32_t	reserved6[108]; -	mx28_reg_32(hw_pinctrl_doe0)		/* 0xb00 */ -	mx28_reg_32(hw_pinctrl_doe1)		/* 0xb10 */ -	mx28_reg_32(hw_pinctrl_doe2)		/* 0xb20 */ -	mx28_reg_32(hw_pinctrl_doe3)		/* 0xb30 */ -	mx28_reg_32(hw_pinctrl_doe4)		/* 0xb40 */ +	mxs_reg_32(hw_pinctrl_doe0)		/* 0xb00 */ +	mxs_reg_32(hw_pinctrl_doe1)		/* 0xb10 */ +	mxs_reg_32(hw_pinctrl_doe2)		/* 0xb20 */ +	mxs_reg_32(hw_pinctrl_doe3)		/* 0xb30 */ +	mxs_reg_32(hw_pinctrl_doe4)		/* 0xb40 */  	uint32_t	reserved7[300]; -	mx28_reg_32(hw_pinctrl_pin2irq0)	/* 0x1000 */ -	mx28_reg_32(hw_pinctrl_pin2irq1)	/* 0x1010 */ -	mx28_reg_32(hw_pinctrl_pin2irq2)	/* 0x1020 */ -	mx28_reg_32(hw_pinctrl_pin2irq3)	/* 0x1030 */ -	mx28_reg_32(hw_pinctrl_pin2irq4)	/* 0x1040 */ +	mxs_reg_32(hw_pinctrl_pin2irq0)	/* 0x1000 */ +	mxs_reg_32(hw_pinctrl_pin2irq1)	/* 0x1010 */ +	mxs_reg_32(hw_pinctrl_pin2irq2)	/* 0x1020 */ +	mxs_reg_32(hw_pinctrl_pin2irq3)	/* 0x1030 */ +	mxs_reg_32(hw_pinctrl_pin2irq4)	/* 0x1040 */  	uint32_t	reserved8[44]; -	mx28_reg_32(hw_pinctrl_irqen0)		/* 0x1100 */ -	mx28_reg_32(hw_pinctrl_irqen1)		/* 0x1110 */ -	mx28_reg_32(hw_pinctrl_irqen2)		/* 0x1120 */ -	mx28_reg_32(hw_pinctrl_irqen3)		/* 0x1130 */ -	mx28_reg_32(hw_pinctrl_irqen4)		/* 0x1140 */ +	mxs_reg_32(hw_pinctrl_irqen0)		/* 0x1100 */ +	mxs_reg_32(hw_pinctrl_irqen1)		/* 0x1110 */ +	mxs_reg_32(hw_pinctrl_irqen2)		/* 0x1120 */ +	mxs_reg_32(hw_pinctrl_irqen3)		/* 0x1130 */ +	mxs_reg_32(hw_pinctrl_irqen4)		/* 0x1140 */  	uint32_t	reserved9[44]; -	mx28_reg_32(hw_pinctrl_irqlevel0)	/* 0x1200 */ -	mx28_reg_32(hw_pinctrl_irqlevel1)	/* 0x1210 */ -	mx28_reg_32(hw_pinctrl_irqlevel2)	/* 0x1220 */ -	mx28_reg_32(hw_pinctrl_irqlevel3)	/* 0x1230 */ -	mx28_reg_32(hw_pinctrl_irqlevel4)	/* 0x1240 */ +	mxs_reg_32(hw_pinctrl_irqlevel0)	/* 0x1200 */ +	mxs_reg_32(hw_pinctrl_irqlevel1)	/* 0x1210 */ +	mxs_reg_32(hw_pinctrl_irqlevel2)	/* 0x1220 */ +	mxs_reg_32(hw_pinctrl_irqlevel3)	/* 0x1230 */ +	mxs_reg_32(hw_pinctrl_irqlevel4)	/* 0x1240 */  	uint32_t	reserved10[44]; -	mx28_reg_32(hw_pinctrl_irqpol0)		/* 0x1300 */ -	mx28_reg_32(hw_pinctrl_irqpol1)		/* 0x1310 */ -	mx28_reg_32(hw_pinctrl_irqpol2)		/* 0x1320 */ -	mx28_reg_32(hw_pinctrl_irqpol3)		/* 0x1330 */ -	mx28_reg_32(hw_pinctrl_irqpol4)		/* 0x1340 */ +	mxs_reg_32(hw_pinctrl_irqpol0)		/* 0x1300 */ +	mxs_reg_32(hw_pinctrl_irqpol1)		/* 0x1310 */ +	mxs_reg_32(hw_pinctrl_irqpol2)		/* 0x1320 */ +	mxs_reg_32(hw_pinctrl_irqpol3)		/* 0x1330 */ +	mxs_reg_32(hw_pinctrl_irqpol4)		/* 0x1340 */  	uint32_t	reserved11[44]; -	mx28_reg_32(hw_pinctrl_irqstat0)	/* 0x1400 */ -	mx28_reg_32(hw_pinctrl_irqstat1)	/* 0x1410 */ -	mx28_reg_32(hw_pinctrl_irqstat2)	/* 0x1420 */ -	mx28_reg_32(hw_pinctrl_irqstat3)	/* 0x1430 */ -	mx28_reg_32(hw_pinctrl_irqstat4)	/* 0x1440 */ +	mxs_reg_32(hw_pinctrl_irqstat0)	/* 0x1400 */ +	mxs_reg_32(hw_pinctrl_irqstat1)	/* 0x1410 */ +	mxs_reg_32(hw_pinctrl_irqstat2)	/* 0x1420 */ +	mxs_reg_32(hw_pinctrl_irqstat3)	/* 0x1430 */ +	mxs_reg_32(hw_pinctrl_irqstat4)	/* 0x1440 */  	uint32_t	reserved12[380]; -	mx28_reg_32(hw_pinctrl_emi_odt_ctrl)	/* 0x1a40 */ +	mxs_reg_32(hw_pinctrl_emi_odt_ctrl)	/* 0x1a40 */  	uint32_t	reserved13[76]; -	mx28_reg_32(hw_pinctrl_emi_ds_ctrl)	/* 0x1b80 */ +	mxs_reg_32(hw_pinctrl_emi_ds_ctrl)	/* 0x1b80 */  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-power.h b/arch/arm/include/asm/arch-mxs/regs-power.h index 8eadc6d55..a46a37268 100644 --- a/arch/arm/include/asm/arch-mx28/regs-power.h +++ b/arch/arm/include/asm/arch-mxs/regs-power.h @@ -25,11 +25,11 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_power_regs { -	mx28_reg_32(hw_power_ctrl) -	mx28_reg_32(hw_power_5vctrl) -	mx28_reg_32(hw_power_minpwr) -	mx28_reg_32(hw_power_charge) +struct mxs_power_regs { +	mxs_reg_32(hw_power_ctrl) +	mxs_reg_32(hw_power_5vctrl) +	mxs_reg_32(hw_power_minpwr) +	mxs_reg_32(hw_power_charge)  	uint32_t	hw_power_vdddctrl;  	uint32_t	reserved_vddd[3];  	uint32_t	hw_power_vddactrl; @@ -44,23 +44,23 @@ struct mx28_power_regs {  	uint32_t	reserved_misc[3];  	uint32_t	hw_power_dclimits;  	uint32_t	reserved_dclimits[3]; -	mx28_reg_32(hw_power_loopctrl) +	mxs_reg_32(hw_power_loopctrl)  	uint32_t	hw_power_sts;  	uint32_t	reserved_sts[3]; -	mx28_reg_32(hw_power_speed) +	mxs_reg_32(hw_power_speed)  	uint32_t	hw_power_battmonitor;  	uint32_t	reserved_battmonitor[3];  	uint32_t	reserved[4]; -	mx28_reg_32(hw_power_reset) -	mx28_reg_32(hw_power_debug) -	mx28_reg_32(hw_power_thermal) -	mx28_reg_32(hw_power_usb1ctrl) -	mx28_reg_32(hw_power_special) -	mx28_reg_32(hw_power_version) -	mx28_reg_32(hw_power_anaclkctrl) -	mx28_reg_32(hw_power_refctrl) +	mxs_reg_32(hw_power_reset) +	mxs_reg_32(hw_power_debug) +	mxs_reg_32(hw_power_thermal) +	mxs_reg_32(hw_power_usb1ctrl) +	mxs_reg_32(hw_power_special) +	mxs_reg_32(hw_power_version) +	mxs_reg_32(hw_power_anaclkctrl) +	mxs_reg_32(hw_power_refctrl)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-rtc.h b/arch/arm/include/asm/arch-mxs/regs-rtc.h index e605a0395..6b2dd332e 100644 --- a/arch/arm/include/asm/arch-mx28/regs-rtc.h +++ b/arch/arm/include/asm/arch-mxs/regs-rtc.h @@ -26,21 +26,21 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_rtc_regs { -	mx28_reg_32(hw_rtc_ctrl) -	mx28_reg_32(hw_rtc_stat) -	mx28_reg_32(hw_rtc_milliseconds) -	mx28_reg_32(hw_rtc_seconds) -	mx28_reg_32(hw_rtc_rtc_alarm) -	mx28_reg_32(hw_rtc_watchdog) -	mx28_reg_32(hw_rtc_persistent0) -	mx28_reg_32(hw_rtc_persistent1) -	mx28_reg_32(hw_rtc_persistent2) -	mx28_reg_32(hw_rtc_persistent3) -	mx28_reg_32(hw_rtc_persistent4) -	mx28_reg_32(hw_rtc_persistent5) -	mx28_reg_32(hw_rtc_debug) -	mx28_reg_32(hw_rtc_version) +struct mxs_rtc_regs { +	mxs_reg_32(hw_rtc_ctrl) +	mxs_reg_32(hw_rtc_stat) +	mxs_reg_32(hw_rtc_milliseconds) +	mxs_reg_32(hw_rtc_seconds) +	mxs_reg_32(hw_rtc_rtc_alarm) +	mxs_reg_32(hw_rtc_watchdog) +	mxs_reg_32(hw_rtc_persistent0) +	mxs_reg_32(hw_rtc_persistent1) +	mxs_reg_32(hw_rtc_persistent2) +	mxs_reg_32(hw_rtc_persistent3) +	mxs_reg_32(hw_rtc_persistent4) +	mxs_reg_32(hw_rtc_persistent5) +	mxs_reg_32(hw_rtc_debug) +	mxs_reg_32(hw_rtc_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-ssp.h b/arch/arm/include/asm/arch-mxs/regs-ssp.h index be71d4894..cf52a28c3 100644 --- a/arch/arm/include/asm/arch-mx28/regs-ssp.h +++ b/arch/arm/include/asm/arch-mxs/regs-ssp.h @@ -28,27 +28,27 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_ssp_regs { -	mx28_reg_32(hw_ssp_ctrl0) -	mx28_reg_32(hw_ssp_cmd0) -	mx28_reg_32(hw_ssp_cmd1) -	mx28_reg_32(hw_ssp_xfer_size) -	mx28_reg_32(hw_ssp_block_size) -	mx28_reg_32(hw_ssp_compref) -	mx28_reg_32(hw_ssp_compmask) -	mx28_reg_32(hw_ssp_timing) -	mx28_reg_32(hw_ssp_ctrl1) -	mx28_reg_32(hw_ssp_data) -	mx28_reg_32(hw_ssp_sdresp0) -	mx28_reg_32(hw_ssp_sdresp1) -	mx28_reg_32(hw_ssp_sdresp2) -	mx28_reg_32(hw_ssp_sdresp3) -	mx28_reg_32(hw_ssp_ddr_ctrl) -	mx28_reg_32(hw_ssp_dll_ctrl) -	mx28_reg_32(hw_ssp_status) -	mx28_reg_32(hw_ssp_dll_sts) -	mx28_reg_32(hw_ssp_debug) -	mx28_reg_32(hw_ssp_version) +struct mxs_ssp_regs { +	mxs_reg_32(hw_ssp_ctrl0) +	mxs_reg_32(hw_ssp_cmd0) +	mxs_reg_32(hw_ssp_cmd1) +	mxs_reg_32(hw_ssp_xfer_size) +	mxs_reg_32(hw_ssp_block_size) +	mxs_reg_32(hw_ssp_compref) +	mxs_reg_32(hw_ssp_compmask) +	mxs_reg_32(hw_ssp_timing) +	mxs_reg_32(hw_ssp_ctrl1) +	mxs_reg_32(hw_ssp_data) +	mxs_reg_32(hw_ssp_sdresp0) +	mxs_reg_32(hw_ssp_sdresp1) +	mxs_reg_32(hw_ssp_sdresp2) +	mxs_reg_32(hw_ssp_sdresp3) +	mxs_reg_32(hw_ssp_ddr_ctrl) +	mxs_reg_32(hw_ssp_dll_ctrl) +	mxs_reg_32(hw_ssp_status) +	mxs_reg_32(hw_ssp_dll_sts) +	mxs_reg_32(hw_ssp_debug) +	mxs_reg_32(hw_ssp_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-timrot.h b/arch/arm/include/asm/arch-mxs/regs-timrot.h index 3e8dfe782..529a3bcdd 100644 --- a/arch/arm/include/asm/arch-mx28/regs-timrot.h +++ b/arch/arm/include/asm/arch-mxs/regs-timrot.h @@ -28,26 +28,26 @@  #include <asm/arch/regs-common.h>  #ifndef	__ASSEMBLY__ -struct mx28_timrot_regs { -	mx28_reg_32(hw_timrot_rotctrl) -	mx28_reg_32(hw_timrot_rotcount) -	mx28_reg_32(hw_timrot_timctrl0) -	mx28_reg_32(hw_timrot_running_count0) -	mx28_reg_32(hw_timrot_fixed_count0) -	mx28_reg_32(hw_timrot_match_count0) -	mx28_reg_32(hw_timrot_timctrl1) -	mx28_reg_32(hw_timrot_running_count1) -	mx28_reg_32(hw_timrot_fixed_count1) -	mx28_reg_32(hw_timrot_match_count1) -	mx28_reg_32(hw_timrot_timctrl2) -	mx28_reg_32(hw_timrot_running_count2) -	mx28_reg_32(hw_timrot_fixed_count2) -	mx28_reg_32(hw_timrot_match_count2) -	mx28_reg_32(hw_timrot_timctrl3) -	mx28_reg_32(hw_timrot_running_count3) -	mx28_reg_32(hw_timrot_fixed_count3) -	mx28_reg_32(hw_timrot_match_count3) -	mx28_reg_32(hw_timrot_version) +struct mxs_timrot_regs { +	mxs_reg_32(hw_timrot_rotctrl) +	mxs_reg_32(hw_timrot_rotcount) +	mxs_reg_32(hw_timrot_timctrl0) +	mxs_reg_32(hw_timrot_running_count0) +	mxs_reg_32(hw_timrot_fixed_count0) +	mxs_reg_32(hw_timrot_match_count0) +	mxs_reg_32(hw_timrot_timctrl1) +	mxs_reg_32(hw_timrot_running_count1) +	mxs_reg_32(hw_timrot_fixed_count1) +	mxs_reg_32(hw_timrot_match_count1) +	mxs_reg_32(hw_timrot_timctrl2) +	mxs_reg_32(hw_timrot_running_count2) +	mxs_reg_32(hw_timrot_fixed_count2) +	mxs_reg_32(hw_timrot_match_count2) +	mxs_reg_32(hw_timrot_timctrl3) +	mxs_reg_32(hw_timrot_running_count3) +	mxs_reg_32(hw_timrot_fixed_count3) +	mxs_reg_32(hw_timrot_match_count3) +	mxs_reg_32(hw_timrot_version)  };  #endif diff --git a/arch/arm/include/asm/arch-mx28/regs-usb.h b/arch/arm/include/asm/arch-mxs/regs-usb.h index ea61de80d..d8bcd77d4 100644 --- a/arch/arm/include/asm/arch-mx28/regs-usb.h +++ b/arch/arm/include/asm/arch-mxs/regs-usb.h @@ -23,7 +23,7 @@  #ifndef __REGS_USB_H__  #define __REGS_USB_H__ -struct mx28_usb_regs { +struct mxs_usb_regs {  	uint32_t		hw_usbctrl_id;			/* 0x000 */  	uint32_t		hw_usbctrl_hwgeneral;		/* 0x004 */  	uint32_t		hw_usbctrl_hwhost;		/* 0x008 */ diff --git a/arch/arm/include/asm/arch-mx28/regs-usbphy.h b/arch/arm/include/asm/arch-mxs/regs-usbphy.h index 0291d815c..288e8fa6d 100644 --- a/arch/arm/include/asm/arch-mx28/regs-usbphy.h +++ b/arch/arm/include/asm/arch-mxs/regs-usbphy.h @@ -23,17 +23,17 @@  #ifndef __REGS_USBPHY_H__  #define __REGS_USBPHY_H__ -struct mx28_usbphy_regs { -	mx28_reg_32(hw_usbphy_pwd) -	mx28_reg_32(hw_usbphy_tx) -	mx28_reg_32(hw_usbphy_rx) -	mx28_reg_32(hw_usbphy_ctrl) -	mx28_reg_32(hw_usbphy_status) -	mx28_reg_32(hw_usbphy_debug) -	mx28_reg_32(hw_usbphy_debug0_status) -	mx28_reg_32(hw_usbphy_debug1) -	mx28_reg_32(hw_usbphy_version) -	mx28_reg_32(hw_usbphy_ip) +struct mxs_usbphy_regs { +	mxs_reg_32(hw_usbphy_pwd) +	mxs_reg_32(hw_usbphy_tx) +	mxs_reg_32(hw_usbphy_rx) +	mxs_reg_32(hw_usbphy_ctrl) +	mxs_reg_32(hw_usbphy_status) +	mxs_reg_32(hw_usbphy_debug) +	mxs_reg_32(hw_usbphy_debug0_status) +	mxs_reg_32(hw_usbphy_debug1) +	mxs_reg_32(hw_usbphy_version) +	mxs_reg_32(hw_usbphy_ip)  };  #define	USBPHY_PWD_RXPWDRX				(1 << 20) diff --git a/arch/arm/include/asm/arch-mx28/sys_proto.h b/arch/arm/include/asm/arch-mxs/sys_proto.h index e701c6409..9bddc12d4 100644 --- a/arch/arm/include/asm/arch-mx28/sys_proto.h +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h @@ -1,5 +1,5 @@  /* - * Freescale i.MX28 MX28 specific functions + * Freescale i.MX23/i.MX28 specific functions   *   * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>   * on behalf of DENX Software Engineering GmbH @@ -20,32 +20,32 @@   *   */ -#ifndef __MX28_H__ -#define __MX28_H__ +#ifndef __SYS_PROTO_H__ +#define __SYS_PROTO_H__ -int mx28_reset_block(struct mx28_register_32 *reg); -int mx28_wait_mask_set(struct mx28_register_32 *reg, +int mxs_reset_block(struct mxs_register_32 *reg); +int mxs_wait_mask_set(struct mxs_register_32 *reg,  		       uint32_t mask, -		       int timeout); -int mx28_wait_mask_clr(struct mx28_register_32 *reg, +		       unsigned int timeout); +int mxs_wait_mask_clr(struct mxs_register_32 *reg,  		       uint32_t mask, -		       int timeout); +		       unsigned int timeout);  int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int));  #ifdef CONFIG_SPL_BUILD  #include <asm/arch/iomux-mx28.h> -void mx28_common_spl_init(const iomux_cfg_t *iomux_setup, +void mxs_common_spl_init(const iomux_cfg_t *iomux_setup,  			const unsigned int iomux_size);  #endif -struct mx28_pair { +struct mxs_pair {  	uint8_t	boot_pads;  	uint8_t boot_mask;  	const char *mode;  }; -static const struct mx28_pair mx28_boot_modes[] = { +static const struct mxs_pair mxs_boot_modes[] = {  	{ 0x00, 0x0f, "USB #0" },  	{ 0x01, 0x1f, "I2C #0, master, 3V3" },  	{ 0x11, 0x1f, "I2C #0, master, 1V8" }, @@ -64,11 +64,11 @@ static const struct mx28_pair mx28_boot_modes[] = {  	{ 0x00, 0x00, "Reserved/Unknown/Wrong" },  }; -struct mx28_spl_data { +struct mxs_spl_data {  	uint8_t		boot_mode_idx;  	uint32_t	mem_dram_size;  }; -int mx28_dram_init(void); +int mxs_dram_init(void); -#endif	/* __MX28_H__ */ +#endif	/* __SYS_PROTO_H__ */ diff --git a/arch/arm/include/asm/arch-omap24xx/omap2420.h b/arch/arm/include/asm/arch-omap24xx/omap2420.h index 603241964..d8d5647e8 100644 --- a/arch/arm/include/asm/arch-omap24xx/omap2420.h +++ b/arch/arm/include/asm/arch-omap24xx/omap2420.h @@ -228,16 +228,6 @@  #define LAN_RESET_REGISTER    (H4_CS1_BASE+0x1c)  #endif  /* endif CONFIG_2420H4 */ -#if defined(CONFIG_APOLLON) -#define APOLLON_CS0_BASE	0x00000000	/* OneNAND */ -#define APOLLON_CS1_BASE	0x08000000	/* ethernet */ -#define APOLLON_CS2_BASE	0x10000000	/* OneNAND */ -#define APOLLON_CS3_BASE	0x18000000	/* NOR */ - -#define ETH_CONTROL_REG		(APOLLON_CS1_BASE + 0x30b) -#define LAN_RESET_REGISTER	(APOLLON_CS1_BASE + 0x1c) -#endif	/* endif CONFIG_APOLLON */ -  /* Common */  #define LOW_LEVEL_SRAM_STACK  0x4020FFFC diff --git a/arch/arm/include/asm/arch-omap3/dss.h b/arch/arm/include/asm/arch-omap3/dss.h index a830c43de..54add4b45 100644 --- a/arch/arm/include/asm/arch-omap3/dss.h +++ b/arch/arm/include/asm/arch-omap3/dss.h @@ -142,7 +142,6 @@ struct venc_regs {  };  /* Few Register Offsets */ -#define FRAME_MODE_SHIFT			1  #define TFTSTN_SHIFT				3  #define DATALINES_SHIFT				8 @@ -182,6 +181,16 @@ struct panel_config {  	void *frame_buffer;  }; +#define DSS_HBP(bp)    (((bp) - 1) << 20) +#define DSS_HFP(fp)    (((fp) - 1) << 8) +#define DSS_HSW(sw)    ((sw) - 1) +#define DSS_VBP(bp)    ((bp) << 20) +#define DSS_VFP(fp)    ((fp) << 8) +#define DSS_VSW(sw)    ((sw) - 1) + +#define PANEL_TIMING_H(bp, fp, sw) (DSS_HBP(bp) | DSS_HFP(fp) | DSS_HSW(sw)) +#define PANEL_TIMING_V(bp, fp, sw) (DSS_VBP(bp) | DSS_VFP(fp) | DSS_VSW(sw)) +  /* Generic DSS Functions */  void omap3_dss_venc_config(const struct venc_regs *venc_cfg,  			u32 height, u32 width); diff --git a/arch/arm/include/asm/arch-omap3/mem.h b/arch/arm/include/asm/arch-omap3/mem.h index 9f6992a12..12dcf4ed1 100644 --- a/arch/arm/include/asm/arch-omap3/mem.h +++ b/arch/arm/include/asm/arch-omap3/mem.h @@ -294,6 +294,35 @@ enum {  #define NUMONYX_RASWIDTH_165		15  #define NUMONYX_V_MCFG_165(size)	MCFG((size), NUMONYX_RASWIDTH_165) +/* NUMONYX part of IGEP v2 (200MHz optimized) 5 ns */ +#define NUMONYX_TDAL_200	6	/* Twr/Tck + Trp/tck		*/ +					/* 15/5 + 15/5 = 3 + 3 -> 6	*/ +#define NUMONYX_TDPL_200	3	/* 15/5 = 3 -> 3 (Twr)	        */ +#define NUMONYX_TRRD_200	2	/* 10/5 = 2			*/ +#define NUMONYX_TRCD_200	4	/* 16.2/5 = 3.24 -> 4		*/ +#define NUMONYX_TRP_200		3	/* 15/5 = 3			*/ +#define NUMONYX_TRAS_200	8	/* 40/5 = 8			*/ +#define NUMONYX_TRC_200		11	/* 55/5 = 11			*/ +#define NUMONYX_TRFC_200        28      /* 140/5 = 28                   */ + +#define NUMONYX_V_ACTIMA_200	\ +		ACTIM_CTRLA(NUMONYX_TRFC_200, NUMONYX_TRC_200,		\ +				NUMONYX_TRAS_200, NUMONYX_TRP_200,	\ +				NUMONYX_TRCD_200, NUMONYX_TRRD_200,	\ +				NUMONYX_TDPL_200, NUMONYX_TDAL_200) + +#define NUMONYX_TWTR_200	2 +#define NUMONYX_TCKE_200	2 +#define NUMONYX_TXP_200		3 +#define NUMONYX_XSR_200		40 + +#define NUMONYX_V_ACTIMB_200	\ +		ACTIM_CTRLB(NUMONYX_TWTR_200, NUMONYX_TCKE_200,	\ +				NUMONYX_TXP_200, NUMONYX_XSR_200) + +#define NUMONYX_RASWIDTH_200		15 +#define NUMONYX_V_MCFG_200(size)	MCFG((size), NUMONYX_RASWIDTH_200) +  /*   * GPMC settings -   * Definitions is as per the following format diff --git a/arch/arm/include/asm/arch-omap3/mux.h b/arch/arm/include/asm/arch-omap3/mux.h index 71f183de8..6e92b23da 100644 --- a/arch/arm/include/asm/arch-omap3/mux.h +++ b/arch/arm/include/asm/arch-omap3/mux.h @@ -451,6 +451,11 @@  #define CONTROL_PADCONF_GPIO128		0x0A58  #define CONTROL_PADCONF_GPIO129		0x0A5A +/* AM/DM37xx specific: gpio_127, gpio_127 and gpio_129 require configuration + * of the extended drain cells */ +#define OMAP34XX_CTRL_WKUP_CTRL		(OMAP34XX_CTRL_BASE + 0x0A5C) +#define OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ	(1<<6) +  #define MUX_VAL(OFFSET,VALUE)\  	writew((VALUE), OMAP34XX_CTRL_BASE + (OFFSET)); diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h index a8c4c60c8..3a0bfbf0c 100644 --- a/arch/arm/include/asm/arch-omap4/cpu.h +++ b/arch/arm/include/asm/arch-omap4/cpu.h @@ -138,6 +138,7 @@ struct watchdog {  #define I2C_BASE1		(OMAP44XX_L4_PER_BASE + 0x70000)  #define I2C_BASE2		(OMAP44XX_L4_PER_BASE + 0x72000)  #define I2C_BASE3		(OMAP44XX_L4_PER_BASE + 0x60000) +#define I2C_BASE4		(OMAP44XX_L4_PER_BASE + 0x350000)  /* MUSB base */  #define MUSB_BASE		(OMAP44XX_L4_CORE_BASE + 0xAB000) diff --git a/arch/arm/include/asm/arch-omap4/i2c.h b/arch/arm/include/asm/arch-omap4/i2c.h index a91b4c2f3..02ee2f88a 100644 --- a/arch/arm/include/asm/arch-omap4/i2c.h +++ b/arch/arm/include/asm/arch-omap4/i2c.h @@ -23,7 +23,7 @@  #ifndef _OMAP4_I2C_H_  #define _OMAP4_I2C_H_ -#define I2C_BUS_MAX	3 +#define I2C_BUS_MAX	4  #define I2C_DEFAULT_BASE	I2C_BASE1  struct i2c { diff --git a/arch/arm/include/asm/arch-omap4/omap.h b/arch/arm/include/asm/arch-omap4/omap.h index 03bd92314..d4b507610 100644 --- a/arch/arm/include/asm/arch-omap4/omap.h +++ b/arch/arm/include/asm/arch-omap4/omap.h @@ -172,7 +172,6 @@ struct control_lpddr2io_regs {  /* base address for indirect vectors (internal boot mode) */  #define SRAM_ROM_VECT_BASE	0x4030D000  /* Temporary SRAM stack used while low level init is done */ -#define LOW_LEVEL_SRAM_STACK		NON_SECURE_SRAM_END  #define SRAM_SCRATCH_SPACE_ADDR		NON_SECURE_SRAM_START  /* SRAM scratch space entries */  #define OMAP4_SRAM_SCRATCH_OMAP4_REV	SRAM_SCRATCH_SPACE_ADDR diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h index 7f05cb5b4..9dce49ac4 100644 --- a/arch/arm/include/asm/arch-omap5/omap.h +++ b/arch/arm/include/asm/arch-omap5/omap.h @@ -262,8 +262,6 @@ struct omap_sys_ctrl_regs {  #define NON_SECURE_SRAM_END	0x40320000	/* Not inclusive */  /* base address for indirect vectors (internal boot mode) */  #define SRAM_ROM_VECT_BASE	0x4031F000 -/* Temporary SRAM stack used while low level init is done */ -#define LOW_LEVEL_SRAM_STACK	NON_SECURE_SRAM_END  #define SRAM_SCRATCH_SPACE_ADDR		NON_SECURE_SRAM_START  /* diff --git a/arch/arm/include/asm/arch-pxa/regs-usb.h b/arch/arm/include/asm/arch-pxa/regs-usb.h new file mode 100644 index 000000000..dda795499 --- /dev/null +++ b/arch/arm/include/asm/arch-pxa/regs-usb.h @@ -0,0 +1,159 @@ +/* + * PXA25x UDC definitions + * + * Copyright (C) 2012 Łukasz Dałek <luk0104@gmail.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 + */ + +#ifndef __REGS_USB_H__ +#define __REGS_USB_H__ + +struct pxa25x_udc_regs { +	/* UDC Control Register */ +	uint32_t	udccr; /* 0x000 */ +	uint32_t	reserved1; + +	/* UDC Control Function Register */ +	uint32_t	udccfr; /* 0x008 */ +	uint32_t	reserved2; + +	/* UDC Endpoint Control/Status Registers */ +	uint32_t	udccs[16]; /* 0x010 - 0x04c */ + +	/* UDC Interrupt Control/Status Registers */ +	uint32_t	uicr0; /* 0x050 */ +	uint32_t	uicr1; /* 0x054 */ +	uint32_t	usir0; /* 0x058 */ +	uint32_t	usir1; /* 0x05c */ + +	/* UDC Frame Number/Byte Count Registers */ +	uint32_t	ufnrh;  /* 0x060 */ +	uint32_t	ufnrl;  /* 0x064 */ +	uint32_t	ubcr2;  /* 0x068 */ +	uint32_t	ubcr4;  /* 0x06c */ +	uint32_t	ubcr7;  /* 0x070 */ +	uint32_t	ubcr9;  /* 0x074 */ +	uint32_t	ubcr12; /* 0x078 */ +	uint32_t	ubcr14; /* 0x07c */ + +	/* UDC Endpoint Data Registers */ +	uint32_t	uddr0;  /* 0x080 */ +	uint32_t	reserved3[7]; +	uint32_t	uddr5;  /* 0x0a0 */ +	uint32_t	reserved4[7]; +	uint32_t	uddr10; /* 0x0c0 */ +	uint32_t	reserved5[7]; +	uint32_t	uddr15; /* 0x0e0 */ +	uint32_t	reserved6[7]; +	uint32_t	uddr1;  /* 0x100 */ +	uint32_t	reserved7[31]; +	uint32_t	uddr2;  /* 0x180 */ +	uint32_t	reserved8[31]; +	uint32_t	uddr3;  /* 0x200 */ +	uint32_t	reserved9[127]; +	uint32_t	uddr4;  /* 0x400 */ +	uint32_t	reserved10[127]; +	uint32_t	uddr6;  /* 0x600 */ +	uint32_t	reserved11[31]; +	uint32_t	uddr7;  /* 0x680 */ +	uint32_t	reserved12[31]; +	uint32_t	uddr8;  /* 0x700 */ +	uint32_t	reserved13[127]; +	uint32_t	uddr9;  /* 0x900 */ +	uint32_t	reserved14[127]; +	uint32_t	uddr11; /* 0xb00 */ +	uint32_t	reserved15[31]; +	uint32_t	uddr12; /* 0xb80 */ +	uint32_t	reserved16[31]; +	uint32_t	uddr13; /* 0xc00 */ +	uint32_t	reserved17[127]; +	uint32_t	uddr14; /* 0xe00 */ + +}; + +#define PXA25X_UDC_BASE		0x40600000 + +#define UDCCR_UDE		(1 << 0) +#define UDCCR_UDA		(1 << 1) +#define UDCCR_RSM		(1 << 2) +#define UDCCR_RESIR		(1 << 3) +#define UDCCR_SUSIR		(1 << 4) +#define UDCCR_SRM		(1 << 5) +#define UDCCR_RSTIR		(1 << 6) +#define UDCCR_REM		(1 << 7) + +/* Bulk IN endpoint 1/6/11 */ +#define UDCCS_BI_TSP		(1 << 7) +#define UDCCS_BI_FST		(1 << 5) +#define UDCCS_BI_SST		(1 << 4) +#define UDCCS_BI_TUR		(1 << 3) +#define UDCCS_BI_FTF		(1 << 2) +#define UDCCS_BI_TPC		(1 << 1) +#define UDCCS_BI_TFS		(1 << 0) + +/* Bulk OUT endpoint 2/7/12 */ +#define UDCCS_BO_RSP		(1 << 7) +#define UDCCS_BO_RNE		(1 << 6) +#define UDCCS_BO_FST		(1 << 5) +#define UDCCS_BO_SST		(1 << 4) +#define UDCCS_BO_DME		(1 << 3) +#define UDCCS_BO_RPC		(1 << 1) +#define UDCCS_BO_RFS		(1 << 0) + +/* Isochronous OUT endpoint 4/9/14 */ +#define UDCCS_IO_RSP		(1 << 7) +#define UDCCS_IO_RNE		(1 << 6) +#define UDCCS_IO_DME		(1 << 3) +#define UDCCS_IO_ROF		(1 << 2) +#define UDCCS_IO_RPC		(1 << 1) +#define UDCCS_IO_RFS		(1 << 0) + +/* Control endpoint 0 */ +#define UDCCS0_OPR		(1 << 0) +#define UDCCS0_IPR		(1 << 1) +#define UDCCS0_FTF		(1 << 2) +#define UDCCS0_DRWF		(1 << 3) +#define UDCCS0_SST		(1 << 4) +#define UDCCS0_FST		(1 << 5) +#define UDCCS0_RNE		(1 << 6) +#define UDCCS0_SA		(1 << 7) + +#define UICR0_IM0		(1 << 0) + +#define USIR0_IR0		(1 << 0) +#define USIR0_IR1		(1 << 1) +#define USIR0_IR2		(1 << 2) +#define USIR0_IR3		(1 << 3) +#define USIR0_IR4		(1 << 4) +#define USIR0_IR5		(1 << 5) +#define USIR0_IR6		(1 << 6) +#define USIR0_IR7		(1 << 7) + +#define UDCCFR_AREN		(1 << 7) /* ACK response enable (now) */ +#define UDCCFR_ACM		(1 << 2) /* ACK control mode (wait for AREN) */ +/* + * Intel(R) PXA255 Processor Specification, September 2003 (page 31) + * define new "must be one" bits in UDCCFR (see Table 12-13.) + */ +#define UDCCFR_MB1		(0xff & ~(UDCCFR_AREN | UDCCFR_ACM)) + +#define UFNRH_SIR		(1 << 7)	/* SOF interrupt request */ +#define UFNRH_SIM		(1 << 6)	/* SOF interrupt mask */ +#define UFNRH_IPE14		(1 << 5)	/* ISO packet error, ep14 */ +#define UFNRH_IPE9		(1 << 4)	/* ISO packet error, ep9 */ +#define UFNRH_IPE4		(1 << 3)	/* ISO packet error, ep4 */ + +#endif /* __REGS_USB_H__ */ diff --git a/arch/arm/include/asm/arch-s5pc1xx/mmc.h b/arch/arm/include/asm/arch-s5pc1xx/mmc.h index 0f701c901..afdfcf049 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/mmc.h +++ b/arch/arm/include/asm/arch-s5pc1xx/mmc.h @@ -64,11 +64,11 @@  #define SDHCI_CTRL4_DRIVE_MASK(_x)	((_x) << 16)  #define SDHCI_CTRL4_DRIVE_SHIFT		(16) -int s5p_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks); +int s5p_sdhci_init(u32 regbase, int index, int bus_width);  static inline unsigned int s5p_mmc_init(int index, int bus_width)  {  	unsigned int base = samsung_get_base_mmc() + (0x10000 * index); -	return s5p_sdhci_init(base, 52000000, 400000, index); +	return s5p_sdhci_init(base, index, bus_width);  }  #endif diff --git a/arch/arm/include/asm/arch-tegra2/ap20.h b/arch/arm/include/asm/arch-tegra20/ap20.h index d222c4423..70d94c504 100644 --- a/arch/arm/include/asm/arch-tegra2/ap20.h +++ b/arch/arm/include/asm/arch-tegra20/ap20.h @@ -95,9 +95,6 @@  #define HALT_COP_EVENT_IRQ_1		(1 << 11)  #define HALT_COP_EVENT_FIQ_1		(1 << 9) -/* Start up the tegra2 SOC */ -void tegra2_start(void); -  /* This is the main entry into U-Boot, used by the Cortex-A9 */  extern void _start(void); diff --git a/arch/arm/include/asm/arch-tegra2/apb_misc.h b/arch/arm/include/asm/arch-tegra20/apb_misc.h index eb69d18d0..eb69d18d0 100644 --- a/arch/arm/include/asm/arch-tegra2/apb_misc.h +++ b/arch/arm/include/asm/arch-tegra20/apb_misc.h diff --git a/arch/arm/include/asm/arch-tegra2/board.h b/arch/arm/include/asm/arch-tegra20/board.h index a90d36c70..a90d36c70 100644 --- a/arch/arm/include/asm/arch-tegra2/board.h +++ b/arch/arm/include/asm/arch-tegra20/board.h diff --git a/arch/arm/include/asm/arch-tegra2/clk_rst.h b/arch/arm/include/asm/arch-tegra20/clk_rst.h index 8c3be9151..8c3be9151 100644 --- a/arch/arm/include/asm/arch-tegra2/clk_rst.h +++ b/arch/arm/include/asm/arch-tegra20/clk_rst.h diff --git a/arch/arm/include/asm/arch-tegra2/clock.h b/arch/arm/include/asm/arch-tegra20/clock.h index ff83bbf29..ff83bbf29 100644 --- a/arch/arm/include/asm/arch-tegra2/clock.h +++ b/arch/arm/include/asm/arch-tegra20/clock.h diff --git a/arch/arm/include/asm/arch-tegra2/emc.h b/arch/arm/include/asm/arch-tegra20/emc.h index deb3d36ed..deb3d36ed 100644 --- a/arch/arm/include/asm/arch-tegra2/emc.h +++ b/arch/arm/include/asm/arch-tegra20/emc.h diff --git a/arch/arm/include/asm/arch-tegra2/flow.h b/arch/arm/include/asm/arch-tegra20/flow.h index cce6cbf7d..cce6cbf7d 100644 --- a/arch/arm/include/asm/arch-tegra2/flow.h +++ b/arch/arm/include/asm/arch-tegra20/flow.h diff --git a/arch/arm/include/asm/arch-tegra2/funcmux.h b/arch/arm/include/asm/arch-tegra20/funcmux.h index dcd512f08..bd511db85 100644 --- a/arch/arm/include/asm/arch-tegra2/funcmux.h +++ b/arch/arm/include/asm/arch-tegra20/funcmux.h @@ -19,7 +19,7 @@   * MA 02111-1307 USA   */ -/* Tegra2 high-level function multiplexing */ +/* Tegra20 high-level function multiplexing */  #ifndef __FUNCMUX_H  #define __FUNCMUX_H @@ -57,6 +57,9 @@ enum {  	/* Serial Flash configs */  	FUNCMUX_SPI1_GMC_GMD = 0, + +	/* NAND flags */ +	FUNCMUX_NDFLASH_ATC = 0,  };  /** diff --git a/arch/arm/include/asm/arch-tegra2/fuse.h b/arch/arm/include/asm/arch-tegra20/fuse.h index b7e3808a4..b7e3808a4 100644 --- a/arch/arm/include/asm/arch-tegra2/fuse.h +++ b/arch/arm/include/asm/arch-tegra20/fuse.h diff --git a/arch/arm/include/asm/arch-tegra2/gp_padctrl.h b/arch/arm/include/asm/arch-tegra20/gp_padctrl.h index 1755ab2ea..865af5bc7 100644 --- a/arch/arm/include/asm/arch-tegra2/gp_padctrl.h +++ b/arch/arm/include/asm/arch-tegra20/gp_padctrl.h @@ -68,6 +68,6 @@ struct apb_misc_gp_ctlr {  #define HIDREV_MAJORPREV_MASK		(0xf << HIDREV_MAJORPREV_SHIFT)  /* CHIPID field returned from APB_MISC_GP_HIDREV register */ -#define CHIPID_TEGRA2				0x20 +#define CHIPID_TEGRA20				0x20  #endif diff --git a/arch/arm/include/asm/arch-tegra2/gpio.h b/arch/arm/include/asm/arch-tegra20/gpio.h index 40ddb0256..06be4c28b 100644 --- a/arch/arm/include/asm/arch-tegra2/gpio.h +++ b/arch/arm/include/asm/arch-tegra20/gpio.h @@ -281,7 +281,7 @@ enum gpio_pin {  };  /* - * Tegra2-specific GPIO API + * Tegra20-specific GPIO API   */  void gpio_info(void); diff --git a/arch/arm/include/asm/arch-tegra20/hardware.h b/arch/arm/include/asm/arch-tegra20/hardware.h new file mode 100644 index 000000000..8c4757833 --- /dev/null +++ b/arch/arm/include/asm/arch-tegra20/hardware.h @@ -0,0 +1,29 @@ +/* +* (C) Copyright 2010-2011 +* NVIDIA Corporation <www.nvidia.com> +* +* 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 +*/ + +#ifndef __TEGRA2_HW_H +#define __TEGRA2_HW_H + +/* include tegra specific hardware definitions */ + +#endif /* __TEGRA2_HW_H */ diff --git a/arch/arm/include/asm/arch-tegra2/mmc.h b/arch/arm/include/asm/arch-tegra20/mmc.h index c1f12dbe4..5c9504799 100644 --- a/arch/arm/include/asm/arch-tegra2/mmc.h +++ b/arch/arm/include/asm/arch-tegra20/mmc.h @@ -19,9 +19,9 @@   * MA 02111-1307 USA   */ -#ifndef _TEGRA2_MMC_H_ -#define _TEGRA2_MMC_H_ +#ifndef _TEGRA_MMC_H_ +#define _TEGRA_MMC_H_ -int tegra2_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio); +int tegra_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio); -#endif /* TEGRA2_MMC_H_ */ +#endif /* _TEGRA_MMC_H_ */ diff --git a/arch/arm/include/asm/arch-tegra2/pinmux.h b/arch/arm/include/asm/arch-tegra20/pinmux.h index 03fa7ca64..03fa7ca64 100644 --- a/arch/arm/include/asm/arch-tegra2/pinmux.h +++ b/arch/arm/include/asm/arch-tegra20/pinmux.h diff --git a/arch/arm/include/asm/arch-tegra2/pmc.h b/arch/arm/include/asm/arch-tegra20/pmc.h index b1d47cd2e..b1d47cd2e 100644 --- a/arch/arm/include/asm/arch-tegra2/pmc.h +++ b/arch/arm/include/asm/arch-tegra20/pmc.h diff --git a/arch/arm/include/asm/arch-tegra2/pmu.h b/arch/arm/include/asm/arch-tegra20/pmu.h index 390815fc2..390815fc2 100644 --- a/arch/arm/include/asm/arch-tegra2/pmu.h +++ b/arch/arm/include/asm/arch-tegra20/pmu.h diff --git a/arch/arm/include/asm/arch-tegra2/scu.h b/arch/arm/include/asm/arch-tegra20/scu.h index 787ded0fe..787ded0fe 100644 --- a/arch/arm/include/asm/arch-tegra2/scu.h +++ b/arch/arm/include/asm/arch-tegra20/scu.h diff --git a/arch/arm/include/asm/arch-tegra2/sdram_param.h b/arch/arm/include/asm/arch-tegra20/sdram_param.h index 6c427d084..6c427d084 100644 --- a/arch/arm/include/asm/arch-tegra2/sdram_param.h +++ b/arch/arm/include/asm/arch-tegra20/sdram_param.h diff --git a/arch/arm/include/asm/arch-tegra2/sys_proto.h b/arch/arm/include/asm/arch-tegra20/sys_proto.h index c11534e58..919aec7f7 100644 --- a/arch/arm/include/asm/arch-tegra2/sys_proto.h +++ b/arch/arm/include/asm/arch-tegra20/sys_proto.h @@ -24,12 +24,12 @@  #ifndef _SYS_PROTO_H_  #define _SYS_PROTO_H_ -struct tegra2_sysinfo { +struct tegra_sysinfo {  	char *board_string;  };  void invalidate_dcache(void); -extern const struct tegra2_sysinfo sysinfo; +extern const struct tegra_sysinfo sysinfo;  #endif diff --git a/arch/arm/include/asm/arch-tegra2/tegra2.h b/arch/arm/include/asm/arch-tegra20/tegra20.h index 13d68c017..c9485a1c8 100644 --- a/arch/arm/include/asm/arch-tegra2/tegra2.h +++ b/arch/arm/include/asm/arch-tegra20/tegra20.h @@ -21,8 +21,8 @@   * MA 02111-1307 USA   */ -#ifndef _TEGRA2_H_ -#define _TEGRA2_H_ +#ifndef _TEGRA20_H_ +#define _TEGRA20_H_  #define NV_PA_SDRAM_BASE	0x00000000  #define NV_PA_ARM_PERIPHBASE	0x50040000 @@ -33,21 +33,22 @@  #define NV_PA_GPIO_BASE		0x6000D000  #define NV_PA_EVP_BASE		0x6000F000  #define NV_PA_APB_MISC_BASE	0x70000000 -#define TEGRA2_APB_MISC_GP_BASE	(NV_PA_APB_MISC_BASE + 0x0800) +#define NV_PA_APB_MISC_GP_BASE	(NV_PA_APB_MISC_BASE + 0x0800)  #define NV_PA_APB_UARTA_BASE	(NV_PA_APB_MISC_BASE + 0x6000)  #define NV_PA_APB_UARTB_BASE	(NV_PA_APB_MISC_BASE + 0x6040)  #define NV_PA_APB_UARTC_BASE	(NV_PA_APB_MISC_BASE + 0x6200)  #define NV_PA_APB_UARTD_BASE	(NV_PA_APB_MISC_BASE + 0x6300)  #define NV_PA_APB_UARTE_BASE	(NV_PA_APB_MISC_BASE + 0x6400) -#define TEGRA2_SPI_BASE		(NV_PA_APB_MISC_BASE + 0xC380) -#define TEGRA2_PMC_BASE		(NV_PA_APB_MISC_BASE + 0xE400) -#define TEGRA2_FUSE_BASE	(NV_PA_APB_MISC_BASE + 0xF800) +#define NV_PA_NAND_BASE		(NV_PA_APB_MISC_BASE + 0x8000) +#define NV_PA_SPI_BASE		(NV_PA_APB_MISC_BASE + 0xC380) +#define NV_PA_PMC_BASE		(NV_PA_APB_MISC_BASE + 0xE400) +#define NV_PA_FUSE_BASE		(NV_PA_APB_MISC_BASE + 0xF800)  #define NV_PA_CSITE_BASE	0x70040000  #define TEGRA_USB1_BASE		0xC5000000  #define TEGRA_USB3_BASE		0xC5008000  #define TEGRA_USB_ADDR_MASK	0xFFFFC000 -#define TEGRA2_SDRC_CS0		NV_PA_SDRAM_BASE +#define NV_PA_SDRC_CS0		NV_PA_SDRAM_BASE  #define LOW_LEVEL_SRAM_STACK	0x4000FFFC  #define EARLY_AVP_STACK		(NV_PA_SDRAM_BASE + 0x20000)  #define EARLY_CPU_STACK		(EARLY_AVP_STACK - 4096) @@ -85,7 +86,7 @@ enum {  };  #else  /* __ASSEMBLY__ */ -#define PRM_RSTCTRL		TEGRA2_PMC_BASE +#define PRM_RSTCTRL		NV_PA_PMC_BASE  #endif -#endif	/* TEGRA2_H */ +#endif	/* TEGRA20_H */ diff --git a/arch/arm/include/asm/arch-tegra2/tegra_i2c.h b/arch/arm/include/asm/arch-tegra20/tegra_i2c.h index cfb136c46..6abfe4e80 100644 --- a/arch/arm/include/asm/arch-tegra2/tegra_i2c.h +++ b/arch/arm/include/asm/arch-tegra20/tegra_i2c.h @@ -1,5 +1,5 @@  /* - * NVIDIA Tegra2 I2C controller + * NVIDIA Tegra20 I2C controller   *   * Copyright 2010-2011 NVIDIA Corporation   * diff --git a/arch/arm/include/asm/arch-tegra20/tegra_mmc.h b/arch/arm/include/asm/arch-tegra20/tegra_mmc.h new file mode 100644 index 000000000..dd746cae0 --- /dev/null +++ b/arch/arm/include/asm/arch-tegra20/tegra_mmc.h @@ -0,0 +1,131 @@ +/* + * (C) Copyright 2009 SAMSUNG Electronics + * Minkyu Kang <mk7.kang@samsung.com> + * Portions Copyright (C) 2011-2012 NVIDIA Corporation + * + * 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 __TEGRA_MMC_H_ +#define __TEGRA_MMC_H_ + +#define TEGRA_SDMMC1_BASE	0xC8000000 +#define TEGRA_SDMMC2_BASE	0xC8000200 +#define TEGRA_SDMMC3_BASE	0xC8000400 +#define TEGRA_SDMMC4_BASE	0xC8000600 + +#ifndef __ASSEMBLY__ +struct tegra_mmc { +	unsigned int	sysad;		/* _SYSTEM_ADDRESS_0 */ +	unsigned short	blksize;	/* _BLOCK_SIZE_BLOCK_COUNT_0 15:00 */ +	unsigned short	blkcnt;		/* _BLOCK_SIZE_BLOCK_COUNT_0 31:16 */ +	unsigned int	argument;	/* _ARGUMENT_0 */ +	unsigned short	trnmod;		/* _CMD_XFER_MODE_0 15:00 xfer mode */ +	unsigned short	cmdreg;		/* _CMD_XFER_MODE_0 31:16 cmd reg */ +	unsigned int	rspreg0;	/* _RESPONSE_R0_R1_0 CMD RESP 31:00 */ +	unsigned int	rspreg1;	/* _RESPONSE_R2_R3_0 CMD RESP 63:32 */ +	unsigned int	rspreg2;	/* _RESPONSE_R4_R5_0 CMD RESP 95:64 */ +	unsigned int	rspreg3;	/* _RESPONSE_R6_R7_0 CMD RESP 127:96 */ +	unsigned int	bdata;		/* _BUFFER_DATA_PORT_0 */ +	unsigned int	prnsts;		/* _PRESENT_STATE_0 */ +	unsigned char	hostctl;	/* _POWER_CONTROL_HOST_0 7:00 */ +	unsigned char	pwrcon;		/* _POWER_CONTROL_HOST_0 15:8 */ +	unsigned char	blkgap;		/* _POWER_CONTROL_HOST_9 23:16 */ +	unsigned char	wakcon;		/* _POWER_CONTROL_HOST_0 31:24 */ +	unsigned short	clkcon;		/* _CLOCK_CONTROL_0 15:00 */ +	unsigned char	timeoutcon;	/* _TIMEOUT_CTRL 23:16 */ +	unsigned char	swrst;		/* _SW_RESET_ 31:24 */ +	unsigned int	norintsts;	/* _INTERRUPT_STATUS_0 */ +	unsigned int	norintstsen;	/* _INTERRUPT_STATUS_ENABLE_0 */ +	unsigned int	norintsigen;	/* _INTERRUPT_SIGNAL_ENABLE_0 */ +	unsigned short	acmd12errsts;	/* _AUTO_CMD12_ERR_STATUS_0 15:00 */ +	unsigned char	res1[2];	/* _RESERVED 31:16 */ +	unsigned int	capareg;	/* _CAPABILITIES_0 */ +	unsigned char	res2[4];	/* RESERVED, offset 44h-47h */ +	unsigned int	maxcurr;	/* _MAXIMUM_CURRENT_0 */ +	unsigned char	res3[4];	/* RESERVED, offset 4Ch-4Fh */ +	unsigned short	setacmd12err;	/* offset 50h */ +	unsigned short	setinterr;	/* offset 52h */ +	unsigned char	admaerr;	/* offset 54h */ +	unsigned char	res4[3];	/* RESERVED, offset 55h-57h */ +	unsigned long	admaaddr;	/* offset 58h-5Fh */ +	unsigned char	res5[0x9c];	/* RESERVED, offset 60h-FBh */ +	unsigned short	slotintstatus;	/* offset FCh */ +	unsigned short	hcver;		/* HOST Version */ +	unsigned char	res6[0x100];	/* RESERVED, offset 100h-1FFh */ +}; + +#define TEGRA_MMC_HOSTCTL_DMASEL_MASK				(3 << 3) +#define TEGRA_MMC_HOSTCTL_DMASEL_SDMA				(0 << 3) +#define TEGRA_MMC_HOSTCTL_DMASEL_ADMA2_32BIT			(2 << 3) +#define TEGRA_MMC_HOSTCTL_DMASEL_ADMA2_64BIT			(3 << 3) + +#define TEGRA_MMC_TRNMOD_DMA_ENABLE				(1 << 0) +#define TEGRA_MMC_TRNMOD_BLOCK_COUNT_ENABLE			(1 << 1) +#define TEGRA_MMC_TRNMOD_DATA_XFER_DIR_SEL_WRITE		(0 << 4) +#define TEGRA_MMC_TRNMOD_DATA_XFER_DIR_SEL_READ			(1 << 4) +#define TEGRA_MMC_TRNMOD_MULTI_BLOCK_SELECT			(1 << 5) + +#define TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_MASK			(3 << 0) +#define TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_NO_RESPONSE		(0 << 0) +#define TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_136		(1 << 0) +#define TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_48		(2 << 0) +#define TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_48_BUSY	(3 << 0) + +#define TEGRA_MMC_TRNMOD_CMD_CRC_CHECK				(1 << 3) +#define TEGRA_MMC_TRNMOD_CMD_INDEX_CHECK			(1 << 4) +#define TEGRA_MMC_TRNMOD_DATA_PRESENT_SELECT_DATA_TRANSFER	(1 << 5) + +#define TEGRA_MMC_PRNSTS_CMD_INHIBIT_CMD			(1 << 0) +#define TEGRA_MMC_PRNSTS_CMD_INHIBIT_DAT			(1 << 1) + +#define TEGRA_MMC_CLKCON_INTERNAL_CLOCK_ENABLE			(1 << 0) +#define TEGRA_MMC_CLKCON_INTERNAL_CLOCK_STABLE			(1 << 1) +#define TEGRA_MMC_CLKCON_SD_CLOCK_ENABLE			(1 << 2) + +#define TEGRA_MMC_CLKCON_SDCLK_FREQ_SEL_SHIFT			8 +#define TEGRA_MMC_CLKCON_SDCLK_FREQ_SEL_MASK			(0xff << 8) + +#define TEGRA_MMC_SWRST_SW_RESET_FOR_ALL			(1 << 0) +#define TEGRA_MMC_SWRST_SW_RESET_FOR_CMD_LINE			(1 << 1) +#define TEGRA_MMC_SWRST_SW_RESET_FOR_DAT_LINE			(1 << 2) + +#define TEGRA_MMC_NORINTSTS_CMD_COMPLETE			(1 << 0) +#define TEGRA_MMC_NORINTSTS_XFER_COMPLETE			(1 << 1) +#define TEGRA_MMC_NORINTSTS_DMA_INTERRUPT			(1 << 3) +#define TEGRA_MMC_NORINTSTS_ERR_INTERRUPT			(1 << 15) +#define TEGRA_MMC_NORINTSTS_CMD_TIMEOUT				(1 << 16) + +#define TEGRA_MMC_NORINTSTSEN_CMD_COMPLETE			(1 << 0) +#define TEGRA_MMC_NORINTSTSEN_XFER_COMPLETE			(1 << 1) +#define TEGRA_MMC_NORINTSTSEN_DMA_INTERRUPT			(1 << 3) +#define TEGRA_MMC_NORINTSTSEN_BUFFER_WRITE_READY		(1 << 4) +#define TEGRA_MMC_NORINTSTSEN_BUFFER_READ_READY			(1 << 5) + +#define TEGRA_MMC_NORINTSIGEN_XFER_COMPLETE			(1 << 1) + +struct mmc_host { +	struct tegra_mmc *reg; +	unsigned int version;	/* SDHCI spec. version */ +	unsigned int clock;	/* Current clock (MHz) */ +	unsigned int base;	/* Base address, SDMMC1/2/3/4 */ +	enum periph_id mmc_id;	/* Peripheral ID: PERIPH_ID_... */ +	int pwr_gpio;		/* Power GPIO */ +	int cd_gpio;		/* Change Detect GPIO */ +}; + +#endif	/* __ASSEMBLY__ */ +#endif	/* __TEGRA_MMC_H_ */ diff --git a/arch/arm/include/asm/arch-tegra2/tegra_spi.h b/arch/arm/include/asm/arch-tegra20/tegra_spi.h index 892d90c00..d53a93ff5 100644 --- a/arch/arm/include/asm/arch-tegra2/tegra_spi.h +++ b/arch/arm/include/asm/arch-tegra20/tegra_spi.h @@ -1,5 +1,5 @@  /* - * NVIDIA Tegra2 SPI-FLASH controller + * NVIDIA Tegra20 SPI-FLASH controller   *   * Copyright 2010-2012 NVIDIA Corporation   * @@ -70,6 +70,6 @@ struct spi_tegra {  #define SPI_STAT_CUR_BLKCNT		(1 << 15)  #define SPI_TIMEOUT		1000 -#define TEGRA2_SPI_MAX_FREQ	52000000 +#define TEGRA_SPI_MAX_FREQ	52000000  #endif	/* _TEGRA_SPI_H_ */ diff --git a/arch/arm/include/asm/arch-tegra2/timer.h b/arch/arm/include/asm/arch-tegra20/timer.h index adefa2c6c..fdb99a73e 100644 --- a/arch/arm/include/asm/arch-tegra2/timer.h +++ b/arch/arm/include/asm/arch-tegra20/timer.h @@ -19,10 +19,10 @@   * MA 02111-1307 USA   */ -/* Tegra2 timer functions */ +/* Tegra20 timer functions */ -#ifndef _TEGRA2_TIMER_H -#define _TEGRA2_TIMER_H +#ifndef _TEGRA_TIMER_H +#define _TEGRA_TIMER_H  /* returns the current monotonic timer value in microseconds */  unsigned long timer_get_us(void); diff --git a/arch/arm/include/asm/arch-tegra2/uart-spi-switch.h b/arch/arm/include/asm/arch-tegra20/uart-spi-switch.h index 82ac180ac..82ac180ac 100644 --- a/arch/arm/include/asm/arch-tegra2/uart-spi-switch.h +++ b/arch/arm/include/asm/arch-tegra20/uart-spi-switch.h diff --git a/arch/arm/include/asm/arch-tegra2/uart.h b/arch/arm/include/asm/arch-tegra20/uart.h index aea29a758..aea29a758 100644 --- a/arch/arm/include/asm/arch-tegra2/uart.h +++ b/arch/arm/include/asm/arch-tegra20/uart.h diff --git a/arch/arm/include/asm/arch-tegra2/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h index 638033be5..638033be5 100644 --- a/arch/arm/include/asm/arch-tegra2/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h diff --git a/arch/arm/include/asm/arch-tegra2/warmboot.h b/arch/arm/include/asm/arch-tegra20/warmboot.h index 99ac2e7d2..99ac2e7d2 100644 --- a/arch/arm/include/asm/arch-tegra2/warmboot.h +++ b/arch/arm/include/asm/arch-tegra20/warmboot.h diff --git a/arch/arm/include/asm/arch-u8500/clock.h b/arch/arm/include/asm/arch-u8500/clock.h index b00ab0d21..2a1478409 100644 --- a/arch/arm/include/asm/arch-u8500/clock.h +++ b/arch/arm/include/asm/arch-u8500/clock.h @@ -64,9 +64,6 @@ struct prcmu {  extern void u8500_clock_enable(int periph, int kern, int cluster); -static inline void u8500_prcmu_enable(unsigned int *reg) -{ -	writel(readl(reg) | (1 << 8), reg); -} +void db8500_clocks_init(void);  #endif /* __ASM_ARCH_CLOCK */ diff --git a/arch/arm/include/asm/arch-u8500/db8500_gpio.h b/arch/arm/include/asm/arch-u8500/db8500_gpio.h new file mode 100644 index 000000000..7c85a8917 --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/db8500_gpio.h @@ -0,0 +1,42 @@ +/* + * Structures and registers for GPIO access in the Nomadik SoC + * + * Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code. + * The purpose is that GPIO config found in kernel should work by simply + * copy-paste it to U-boot. + * + * Ported to U-boot by: + * Copyright (C) 2010 Joakim Axelsson <joakim.axelsson AT stericsson.com> + * Copyright (C) 2008 STMicroelectronics + *     Author: Prafulla WADASKAR <prafulla.wadaskar@st.com> + * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __DB8500_GPIO_H__ +#define __DB8500_GPIO_H__ + +/* Alternate functions: function C is set in hw by setting both A and B */ +enum db8500_gpio_alt { +	DB8500_GPIO_ALT_GPIO = 0, +	DB8500_GPIO_ALT_A = 1, +	DB8500_GPIO_ALT_B = 2, +	DB8500_GPIO_ALT_C = (DB8500_GPIO_ALT_A | DB8500_GPIO_ALT_B) +}; + +enum db8500_gpio_pull { +	DB8500_GPIO_PULL_NONE, +	DB8500_GPIO_PULL_UP, +	DB8500_GPIO_PULL_DOWN +}; + +void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull); +void db8500_gpio_make_input(unsigned gpio); +int db8500_gpio_get_input(unsigned gpio); +void db8500_gpio_make_output(unsigned gpio, int val); +void db8500_gpio_set_output(unsigned gpio, int val); + +#endif /* __DB8500_GPIO_H__ */ diff --git a/arch/arm/include/asm/arch-u8500/db8500_pincfg.h b/arch/arm/include/asm/arch-u8500/db8500_pincfg.h new file mode 100644 index 000000000..64957016c --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/db8500_pincfg.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code. + * The purpose is that GPIO config found in kernel should work by simply + * copy-paste it to U-boot. Ported 2010 to U-boot by: + * Author: Joakim Axelsson <joakim.axelsson AT stericsson.com> + * + * License terms: GNU General Public License, version 2 + * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson + * + * + * Based on arch/arm/mach-pxa/include/mach/mfp.h: + *   Copyright (C) 2007 Marvell International Ltd. + *   eric miao <eric.miao@marvell.com> + */ + +#ifndef __DB8500_PINCFG_H +#define __DB8500_PINCFG_H + +#include "db8500_gpio.h" + +/* + * U-boot info: + * SLPM (sleep mode) config will be ignored by U-boot but it is still + * possible to configure it in order to keep cut-n-paste compability + * with Linux kernel config. + * + * pin configurations are represented by 32-bit integers: + * + *	bit  0.. 8 - Pin Number (512 Pins Maximum) + *	bit  9..10 - Alternate Function Selection + *	bit 11..12 - Pull up/down state + *	bit     13 - Sleep mode behaviour (not used in U-boot) + *	bit     14 - Direction + *	bit     15 - Value (if output) + *	bit 16..18 - SLPM pull up/down state (not used in U-boot) + *	bit 19..20 - SLPM direction (not used in U-boot) + *	bit 21..22 - SLPM Value (if output) (not used in U-boot) + * + * to facilitate the definition, the following macros are provided + * + * PIN_CFG_DEFAULT - default config (0): + *		     pull up/down = disabled + *		     sleep mode = input/wakeup + *		     direction = input + *		     value = low + *		     SLPM direction = same as normal + *		     SLPM pull = same as normal + *		     SLPM value = same as normal + * + * PIN_CFG	   - default config with alternate function + * PIN_CFG_PULL	   - default config with alternate function and pull up/down + */ + +/* Sleep mode */ +enum db8500_gpio_slpm { +	DB8500_GPIO_SLPM_INPUT, +	DB8500_GPIO_SLPM_WAKEUP_ENABLE = DB8500_GPIO_SLPM_INPUT, +	DB8500_GPIO_SLPM_NOCHANGE, +	DB8500_GPIO_SLPM_WAKEUP_DISABLE = DB8500_GPIO_SLPM_NOCHANGE, +}; + +#define PIN_NUM_MASK		0x1ff +#define PIN_NUM(x)		((x) & PIN_NUM_MASK) + +#define PIN_ALT_SHIFT		9 +#define PIN_ALT_MASK		(0x3 << PIN_ALT_SHIFT) +#define PIN_ALT(x)		(((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT) +#define PIN_GPIO		(DB8500_GPIO_ALT_GPIO << PIN_ALT_SHIFT) +#define PIN_ALT_A		(DB8500_GPIO_ALT_A << PIN_ALT_SHIFT) +#define PIN_ALT_B		(DB8500_GPIO_ALT_B << PIN_ALT_SHIFT) +#define PIN_ALT_C		(DB8500_GPIO_ALT_C << PIN_ALT_SHIFT) + +#define PIN_PULL_SHIFT		11 +#define PIN_PULL_MASK		(0x3 << PIN_PULL_SHIFT) +#define PIN_PULL(x)		(((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT) +#define PIN_PULL_NONE		(DB8500_GPIO_PULL_NONE << PIN_PULL_SHIFT) +#define PIN_PULL_UP		(DB8500_GPIO_PULL_UP << PIN_PULL_SHIFT) +#define PIN_PULL_DOWN		(DB8500_GPIO_PULL_DOWN << PIN_PULL_SHIFT) + +#define PIN_SLPM_SHIFT		13 +#define PIN_SLPM_MASK		(0x1 << PIN_SLPM_SHIFT) +#define PIN_SLPM(x)		(((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) +#define PIN_SLPM_MAKE_INPUT	(DB8500_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) +#define PIN_SLPM_NOCHANGE	(DB8500_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) +/* These two replace the above in DB8500v2+ */ +#define PIN_SLPM_WAKEUP_ENABLE \ +	(DB8500_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT) +#define PIN_SLPM_WAKEUP_DISABLE \ +	(DB8500_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT) + +#define PIN_DIR_SHIFT		14 +#define PIN_DIR_MASK		(0x1 << PIN_DIR_SHIFT) +#define PIN_DIR(x)		(((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT) +#define PIN_DIR_INPUT		(0 << PIN_DIR_SHIFT) +#define PIN_DIR_OUTPUT		(1 << PIN_DIR_SHIFT) + +#define PIN_VAL_SHIFT		15 +#define PIN_VAL_MASK		(0x1 << PIN_VAL_SHIFT) +#define PIN_VAL(x)		(((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT) +#define PIN_VAL_LOW		(0 << PIN_VAL_SHIFT) +#define PIN_VAL_HIGH		(1 << PIN_VAL_SHIFT) + +#define PIN_SLPM_PULL_SHIFT	16 +#define PIN_SLPM_PULL_MASK	(0x7 << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL(x)	\ +	(((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_NONE	\ +	((1 + DB8500_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_UP	\ +	((1 + DB8500_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_DOWN	\ +	((1 + DB8500_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT) + +#define PIN_SLPM_DIR_SHIFT	19 +#define PIN_SLPM_DIR_MASK	(0x3 << PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR(x)		\ +	(((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR_INPUT	((1 + 0) << PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR_OUTPUT	((1 + 1) << PIN_SLPM_DIR_SHIFT) + +#define PIN_SLPM_VAL_SHIFT	21 +#define PIN_SLPM_VAL_MASK	(0x3 << PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL(x)		\ +	(((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL_LOW	((1 + 0) << PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL_HIGH	((1 + 1) << PIN_SLPM_VAL_SHIFT) + +/* Shortcuts.  Use these instead of separate DIR, PULL, and VAL.  */ +#define PIN_INPUT_PULLDOWN	(PIN_DIR_INPUT | PIN_PULL_DOWN) +#define PIN_INPUT_PULLUP	(PIN_DIR_INPUT | PIN_PULL_UP) +#define PIN_INPUT_NOPULL	(PIN_DIR_INPUT | PIN_PULL_NONE) +#define PIN_OUTPUT_LOW		(PIN_DIR_OUTPUT | PIN_VAL_LOW) +#define PIN_OUTPUT_HIGH		(PIN_DIR_OUTPUT | PIN_VAL_HIGH) + +#define PIN_SLPM_INPUT_PULLDOWN	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN) +#define PIN_SLPM_INPUT_PULLUP	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP) +#define PIN_SLPM_INPUT_NOPULL	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE) +#define PIN_SLPM_OUTPUT_LOW	(PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW) +#define PIN_SLPM_OUTPUT_HIGH	(PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH) + +#define PIN_CFG_DEFAULT		(0) + +#define PIN_CFG(num, alt)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt)) + +#define PIN_CFG_INPUT(num, alt, pull)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull)) + +#define PIN_CFG_OUTPUT(num, alt, val)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val)) + +#define PIN_CFG_PULL(num, alt, pull)	\ +	((PIN_CFG_DEFAULT & ~PIN_PULL_MASK) |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_PULL_##pull)) + +/** + * db8500_gpio_config_pins - configure several pins at once + * @cfgs: array of pin configurations + * @num: number of elments in the array + * + * Configures several GPIO pins. + */ +void db8500_gpio_config_pins(unsigned long *cfgs, size_t num); + +#endif diff --git a/arch/arm/include/asm/arch-u8500/hardware.h b/arch/arm/include/asm/arch-u8500/hardware.h index 6bb95ec07..ee0341932 100644 --- a/arch/arm/include/asm/arch-u8500/hardware.h +++ b/arch/arm/include/asm/arch-u8500/hardware.h @@ -62,7 +62,7 @@  /* Per4 */  #define U8500_PRCMU_BASE	(U8500_PER4_BASE + 0x07000) -#define U8500_PRCMU_TCDM_BASE   (U8500_PER4_BASE + 0x0f000) +#define U8500_PRCMU_TCDM_BASE   (U8500_PER4_BASE + 0x68000)  /* Per3 */  #define U8500_UART2_BASE	(U8500_PER3_BASE + 0x7000) @@ -77,7 +77,34 @@  #define U8500_CLKRST1_BASE	(U8500_PER1_BASE + 0xf000)  /* Last page of Boot ROM */ -#define U8500_BOOTROM_BASE      0x9001f000 -#define U8500_BOOTROM_ASIC_ID_OFFSET    0x0ff4 +#define U8500_BOOTROM_BASE      0x90000000 +#define U8500_ASIC_ID_LOC_ED_V1 (U8500_BOOTROM_BASE + 0x1FFF4) +#define U8500_ASIC_ID_LOC_V2    (U8500_BOOTROM_BASE + 0x1DBF4) + +/* AB8500 specifics */ + +/* address bank */ +#define AB8500_REGU_CTRL2	0x0004 +#define AB8500_MISC		0x0010 + +/* registers */ +#define AB8500_REGU_VRF1VAUX3_REGU_REG	0x040A +#define AB8500_REGU_VRF1VAUX3_SEL_REG	0x0421 +#define AB8500_REV_REG			0x1080 + +#define AB8500_GPIO_SEL2_REG	0x1001 +#define AB8500_GPIO_DIR2_REG	0x1011 +#define AB8500_GPIO_DIR4_REG	0x1013 +#define AB8500_GPIO_SEL4_REG	0x1003 +#define AB8500_GPIO_OUT2_REG	0x1021 +#define AB8500_GPIO_OUT4_REG	0x1023 + +#define LDO_VAUX3_ENABLE_MASK	0x3 +#define LDO_VAUX3_ENABLE_VAL	0x1 +#define LDO_VAUX3_SEL_MASK	0xf +#define LDO_VAUX3_SEL_2V9	0xd +#define LDO_VAUX3_V2_SEL_MASK	0x7 +#define LDO_VAUX3_V2_SEL_2V91	0x7 +  #endif /* __ASM_ARCH_HARDWARE_H */ diff --git a/arch/arm/include/asm/arch-u8500/prcmu.h b/arch/arm/include/asm/arch-u8500/prcmu.h new file mode 100644 index 000000000..e9dcc9325 --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/prcmu.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 ST-Ericsson SA + * + * Copied from the Linux version: + * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef __MACH_PRCMU_FW_V1_H +#define __MACH_PRCMU_FW_V1_H + +#define AP_EXECUTE	2 +#define I2CREAD		1 +#define I2C_WR_OK	1 +#define I2C_RD_OK	2 +#define I2CWRITE	0 + +#define PRCMU_BASE			U8500_PRCMU_BASE +#define PRCMU_BASE_TCDM			U8500_PRCMU_TCDM_BASE +#define PRCM_UARTCLK_MGT_REG		(PRCMU_BASE + 0x018) +#define PRCM_MSPCLK_MGT_REG		(PRCMU_BASE + 0x01C) +#define PRCM_I2CCLK_MGT_REG		(PRCMU_BASE + 0x020) +#define PRCM_SDMMCCLK_MGT_REG		(PRCMU_BASE + 0x024) +#define PRCM_PER1CLK_MGT_REG		(PRCMU_BASE + 0x02C) +#define PRCM_PER2CLK_MGT_REG		(PRCMU_BASE + 0x030) +#define PRCM_PER3CLK_MGT_REG		(PRCMU_BASE + 0x034) +#define PRCM_PER5CLK_MGT_REG		(PRCMU_BASE + 0x038) +#define PRCM_PER6CLK_MGT_REG		(PRCMU_BASE + 0x03C) +#define PRCM_PER7CLK_MGT_REG		(PRCMU_BASE + 0x040) +#define PRCM_MBOX_CPU_VAL		(PRCMU_BASE + 0x0FC) +#define PRCM_MBOX_CPU_SET		(PRCMU_BASE + 0x100) + +#define PRCM_ARM_IT1_CLEAR		(PRCMU_BASE + 0x48C) +#define PRCM_ARM_IT1_VAL		(PRCMU_BASE + 0x494) +#define PRCM_TCR			(PRCMU_BASE + 0x1C8) +#define PRCM_REQ_MB5			(PRCMU_BASE_TCDM + 0xE44) +#define PRCM_ACK_MB5			(PRCMU_BASE_TCDM + 0xDF4) +#define PRCM_XP70_CUR_PWR_STATE		(PRCMU_BASE_TCDM + 0xFFC) +/* Mailbox 5 Requests */ +#define PRCM_REQ_MB5_I2COPTYPE_REG	(PRCM_REQ_MB5 + 0x0) +#define PRCM_REQ_MB5_BIT_FIELDS		(PRCM_REQ_MB5 + 0x1) +#define PRCM_REQ_MB5_I2CSLAVE		(PRCM_REQ_MB5 + 0x2) +#define PRCM_REQ_MB5_I2CVAL		(PRCM_REQ_MB5 + 0x3) + +/* Mailbox 5 ACKs */ +#define PRCM_ACK_MB5_STATUS	(PRCM_ACK_MB5 + 0x1) +#define PRCM_ACK_MB5_SLAVE	(PRCM_ACK_MB5 + 0x2) +#define PRCM_ACK_MB5_VAL	(PRCM_ACK_MB5 + 0x3) + +#define LOW_POWER_WAKEUP	1 +#define EXE_WAKEUP		0 + +#define REQ_MB5			5 + +#define ab8500_read	prcmu_i2c_read +#define ab8500_write	prcmu_i2c_write + +int prcmu_i2c_read(u8 reg, u16 slave); +int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data); + +void u8500_prcmu_enable(u32 *reg); +void db8500_prcmu_init(void); + +#endif /* __MACH_PRCMU_FW_V1_H */ diff --git a/arch/arm/include/asm/arch-u8500/sys_proto.h b/arch/arm/include/asm/arch-u8500/sys_proto.h index bac5e7999..a8ef9e5f4 100644 --- a/arch/arm/include/asm/arch-u8500/sys_proto.h +++ b/arch/arm/include/asm/arch-u8500/sys_proto.h @@ -23,5 +23,6 @@  #define _SYS_PROTO_H_  void gpio_init(void); +int u8500_mmc_power_init(void);  #endif  /* _SYS_PROTO_H_ */ diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h index 674c3de66..ed251ec8e 100644 --- a/arch/arm/include/asm/emif.h +++ b/arch/arm/include/asm/emif.h @@ -19,7 +19,7 @@  #define EMIF1_BASE				0x4c000000  #define EMIF2_BASE				0x4d000000 -/* Registers shifts and masks */ +/* Registers shifts, masks and values */  /* EMIF_MOD_ID_REV */  #define EMIF_REG_SCHEME_SHIFT			30 @@ -46,6 +46,12 @@  /* SDRAM_CONFIG */  #define EMIF_REG_SDRAM_TYPE_SHIFT			29  #define EMIF_REG_SDRAM_TYPE_MASK			(0x7 << 29) +#define EMIF_REG_SDRAM_TYPE_DDR1			0 +#define EMIF_REG_SDRAM_TYPE_LPDDR1			1 +#define EMIF_REG_SDRAM_TYPE_DDR2			2 +#define EMIF_REG_SDRAM_TYPE_DDR3			3 +#define EMIF_REG_SDRAM_TYPE_LPDDR2_S4			4 +#define EMIF_REG_SDRAM_TYPE_LPDDR2_S2			5  #define EMIF_REG_IBANK_POS_SHIFT			27  #define EMIF_REG_IBANK_POS_MASK			(0x3 << 27)  #define EMIF_REG_DDR_TERM_SHIFT			24 diff --git a/arch/arm/include/asm/imx-common/boot_mode.h b/arch/arm/include/asm/imx-common/boot_mode.h new file mode 100644 index 000000000..6d2df7411 --- /dev/null +++ b/arch/arm/include/asm/imx-common/boot_mode.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2012 Boundary Devices Inc. + * + * 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 + */ + +#ifndef _ASM_BOOT_MODE_H +#define _ASM_BOOT_MODE_H +#define MAKE_CFGVAL(cfg1, cfg2, cfg3, cfg4) \ +	((cfg4) << 24) | ((cfg3) << 16) | ((cfg2) << 8) | (cfg1) + +struct boot_mode { +	const char *name; +	unsigned cfg_val; +}; + +void add_board_boot_modes(const struct boot_mode *p); +void boot_mode_apply(unsigned cfg_val); +extern const struct boot_mode soc_boot_modes[]; +#endif diff --git a/arch/arm/include/asm/imx-common/gpio.h b/arch/arm/include/asm/imx-common/gpio.h new file mode 100644 index 000000000..65226d9b4 --- /dev/null +++ b/arch/arm/include/asm/imx-common/gpio.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011 + * Stefano Babic, DENX Software Engineering, <sbabic@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 + */ + + +#ifndef __ASM_ARCH_IMX_GPIO_H +#define __ASM_ARCH_IMX_GPIO_H + +#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) +/* GPIO registers */ +struct gpio_regs { +	u32 gpio_dr;	/* data */ +	u32 gpio_dir;	/* direction */ +	u32 gpio_psr;	/* pad satus */ +}; +#endif + +#define IMX_GPIO_NR(port, index)		((((port)-1)*32)+((index)&31)) + +#endif diff --git a/arch/arm/include/asm/imx-common/iomux-v3.h b/arch/arm/include/asm/imx-common/iomux-v3.h index 788b41321..4558f4fba 100644 --- a/arch/arm/include/asm/imx-common/iomux-v3.h +++ b/arch/arm/include/asm/imx-common/iomux-v3.h @@ -100,115 +100,4 @@ typedef u64 iomux_v3_cfg_t;  int imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad);  int imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count); -/* - * IOMUXC_GPR13 bit fields - */ -#define IOMUXC_GPR13_SDMA_STOP_REQ	(1<<30) -#define IOMUXC_GPR13_CAN2_STOP_REQ	(1<<29) -#define IOMUXC_GPR13_CAN1_STOP_REQ	(1<<28) -#define IOMUXC_GPR13_ENET_STOP_REQ	(1<<27) -#define IOMUXC_GPR13_SATA_PHY_8_MASK	(7<<24) -#define IOMUXC_GPR13_SATA_PHY_7_MASK	(0x1f<<19) -#define IOMUXC_GPR13_SATA_PHY_6_SHIFT	16 -#define IOMUXC_GPR13_SATA_PHY_6_MASK	(7<<IOMUXC_GPR13_SATA_PHY_6_SHIFT) -#define IOMUXC_GPR13_SATA_SPEED_MASK	(1<<15) -#define IOMUXC_GPR13_SATA_PHY_5_MASK	(1<<14) -#define IOMUXC_GPR13_SATA_PHY_4_MASK	(7<<11) -#define IOMUXC_GPR13_SATA_PHY_3_MASK	(0x1f<<7) -#define IOMUXC_GPR13_SATA_PHY_2_MASK	(0x1f<<2) -#define IOMUXC_GPR13_SATA_PHY_1_MASK	(3<<0) - -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_0P5DB	(0b000<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P0DB	(0b001<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P5DB	(0b010<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P0DB	(0b011<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P5DB	(0b100<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB	(0b101<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P5DB	(0b110<<24) -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_4P0DB	(0b111<<24) - -#define IOMUXC_GPR13_SATA_PHY_7_SATA1I	(0b10000<<19) -#define IOMUXC_GPR13_SATA_PHY_7_SATA1M	(0b10000<<19) -#define IOMUXC_GPR13_SATA_PHY_7_SATA1X	(0b11010<<19) -#define IOMUXC_GPR13_SATA_PHY_7_SATA2I	(0b10010<<19) -#define IOMUXC_GPR13_SATA_PHY_7_SATA2M	(0b10010<<19) -#define IOMUXC_GPR13_SATA_PHY_7_SATA2X	(0b11010<<19) - -#define IOMUXC_GPR13_SATA_SPEED_1P5G	(0<<15) -#define IOMUXC_GPR13_SATA_SPEED_3G	(1<<15) - -#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_DISABLED	(0<<14) -#define IOMUXC_GPR13_SATA_SATA_PHY_5_SS_ENABLED		(1<<14) - -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_16_16	(0<<11) -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_14_16	(1<<11) -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_12_16	(2<<11) -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_10_16	(3<<11) -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16		(4<<11) -#define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_8_16		(5<<11) - -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB	(0b0000<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P37_DB	(0b0001<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P74_DB	(0b0010<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P11_DB	(0b0011<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P48_DB	(0b0100<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P85_DB	(0b0101<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P22_DB	(0b0110<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P59_DB	(0b0111<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P96_DB	(0b1000<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P33_DB	(0b1001<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P70_DB	(0b1010<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P07_DB	(0b1011<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P44_DB	(0b1100<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P81_DB	(0b1101<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P28_DB	(0b1110<<7) -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P75_DB	(0b1111<<7) - -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P937V	(0b00000<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P947V	(0b00001<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P957V	(0b00010<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P966V	(0b00011<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P976V	(0b00100<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P986V	(0b00101<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P996V	(0b00110<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P005V	(0b00111<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P015V	(0b01000<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P025V	(0b01001<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P035V	(0b01010<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P045V	(0b01011<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P054V	(0b01100<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P064V	(0b01101<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P074V	(0b01110<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P084V	(0b01111<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P094V	(0b10000<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P104V	(0b10001<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P113V	(0b10010<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P123V	(0b10011<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P133V	(0b10100<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P143V	(0b10101<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P152V	(0b10110<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P162V	(0b10111<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P172V	(0b11000<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P182V	(0b11001<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P191V	(0b11010<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P201V	(0b11011<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P211V	(0b11100<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P221V	(0b11101<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P230V	(0b11110<<2) -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P240V	(0b11111<<2) - -#define IOMUXC_GPR13_SATA_PHY_1_FAST	0 -#define IOMUXC_GPR13_SATA_PHY_1_MEDIUM	1 -#define IOMUXC_GPR13_SATA_PHY_1_SLOW	2 - -#define IOMUXC_GPR13_SATA_MASK (IOMUXC_GPR13_SATA_PHY_8_MASK \ -				|IOMUXC_GPR13_SATA_PHY_7_MASK \ -				|IOMUXC_GPR13_SATA_PHY_6_MASK \ -				|IOMUXC_GPR13_SATA_SPEED_MASK \ -				|IOMUXC_GPR13_SATA_PHY_5_MASK \ -				|IOMUXC_GPR13_SATA_PHY_4_MASK \ -				|IOMUXC_GPR13_SATA_PHY_3_MASK \ -				|IOMUXC_GPR13_SATA_PHY_2_MASK \ -				|IOMUXC_GPR13_SATA_PHY_1_MASK) -  #endif	/* __MACH_IOMUX_V3_H__*/ diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h index 4e95eee59..71ef9b077 100644 --- a/arch/arm/include/asm/omap_common.h +++ b/arch/arm/include/asm/omap_common.h @@ -67,7 +67,7 @@ void preloader_console_init(void);  #elif defined(CONFIG_AM33XX)	/* AM33XX */  #define BOOT_DEVICE_NAND	5  #define BOOT_DEVICE_MMC1	8 -#define BOOT_DEVICE_MMC2	0 +#define BOOT_DEVICE_MMC2	9 /* eMMC or daughter card */  #define BOOT_DEVICE_UART	65  #define BOOT_DEVICE_MMC2_2      0xFF  #endif diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 39a955037..bd3b77f2e 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(ARCH).o  LIBGCC	= $(obj)libgcc.o -ifndef CONFIG_SPL_BUILD  GLSOBJS	+= _ashldi3.o  GLSOBJS	+= _ashrdi3.o  GLSOBJS	+= _divsi3.o @@ -37,6 +36,7 @@ GLSOBJS	+= _umodsi3.o  GLCOBJS	+= div0.o +ifndef CONFIG_SPL_BUILD  COBJS-y	+= board.o  COBJS-y	+= bootm.o  COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index f1951e883..109a1ac75 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -241,6 +241,9 @@ init_fnc_t *init_sequence[] = {  	fdtdec_check_fdt,  #endif  	timer_init,		/* initialize timer */ +#ifdef CONFIG_BOARD_POSTCLK_INIT +	board_postclk_init, +#endif  #ifdef CONFIG_FSL_ESDHC  	get_clocks,  #endif diff --git a/arch/avr32/config.mk b/arch/avr32/config.mk index d8e7ebb0b..a751a3d78 100644 --- a/arch/avr32/config.mk +++ b/arch/avr32/config.mk @@ -29,5 +29,3 @@ PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax  PLATFORM_RELFLAGS	+= -ffunction-sections -fdata-sections  LDFLAGS_u-boot		= --gc-sections --relax - -LDSCRIPT			= $(SRCTREE)/$(CPUDIR)/u-boot.lds diff --git a/arch/avr32/cpu/at32ap700x/portmux.c b/arch/avr32/cpu/at32ap700x/portmux.c index e3e38a2a7..7eb42de06 100644 --- a/arch/avr32/cpu/at32ap700x/portmux.c +++ b/arch/avr32/cpu/at32ap700x/portmux.c @@ -122,7 +122,7 @@ void portmux_enable_macb1(unsigned long flags, unsigned long drive_strength)  		portd_mask |= (1 << 15);/* SPD	*/  	/* REVISIT: Some pins are probably pure outputs */ -	portmux_select_peripheral(PORTMUX_PORT_D, portc_mask, +	portmux_select_peripheral(PORTMUX_PORT_D, portd_mask,  			PORTMUX_FUNC_B, PORTMUX_BUSKEEPER);  	portmux_select_peripheral(PORTMUX_PORT_C, portc_mask,  			PORTMUX_FUNC_B, PORTMUX_BUSKEEPER); diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile index 5deaa9e6a..0a72ec5df 100644 --- a/arch/blackfin/cpu/Makefile +++ b/arch/blackfin/cpu/Makefile @@ -17,7 +17,6 @@ EXTRA    := init.elf  CEXTRA   := initcode.o  SEXTRA   := start.o  SOBJS    := interrupt.o cache.o -COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o  COBJS-y  += cpu.o  COBJS-y  += gpio.o  COBJS-y  += interrupts.o diff --git a/arch/blackfin/cpu/bootcount.c b/arch/blackfin/cpu/bootcount.c deleted file mode 100644 index 6cf6dd58b..000000000 --- a/arch/blackfin/cpu/bootcount.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * functions for handling bootcount support - * - * Copyright (c) 2010 Analog Devices Inc. - * - * Licensed under the 2-clause BSD. - */ - -/* This version uses one 32bit storage and combines the magic/count */ - -#include <common.h> - -/* We abuse the EVT0 MMR for bootcount storage by default */ -#ifndef CONFIG_SYS_BOOTCOUNT_ADDR -# define CONFIG_SYS_BOOTCOUNT_ADDR EVT0 -#endif - -#define MAGIC_MASK 0xffff0000 -#define COUNT_MASK 0x0000ffff - -void bootcount_store(ulong cnt) -{ -	ulong magic = (BOOTCOUNT_MAGIC & MAGIC_MASK) | (cnt & COUNT_MASK); -	bfin_write32(CONFIG_SYS_BOOTCOUNT_ADDR, magic); -} - -ulong bootcount_load(void) -{ -	ulong magic = bfin_read32(CONFIG_SYS_BOOTCOUNT_ADDR); -	if ((magic & MAGIC_MASK) == (BOOTCOUNT_MAGIC & MAGIC_MASK)) -		return magic & COUNT_MASK; -	else -		return 0; -} diff --git a/arch/m68k/cpu/mcf5227x/cpu.c b/arch/m68k/cpu/mcf5227x/cpu.c index 09ef1d2cf..3a0ab9746 100644 --- a/arch/m68k/cpu/mcf5227x/cpu.c +++ b/arch/m68k/cpu/mcf5227x/cpu.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -30,14 +30,15 @@  #include <command.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM); +	rcm_t *rcm = (rcm_t *) (MMAP_RCM);  	udelay(1000); -	rcm->rcr |= RCM_RCR_SOFTRST; +	setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; @@ -45,14 +46,14 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int checkcpu(void)  { -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM;  	u16 msk;  	u16 id = 0;  	u8 ver;  	puts("CPU:   "); -	msk = (ccm->cir >> 6); -	ver = (ccm->cir & 0x003f); +	msk = (in_be16(&ccm->cir) >> 6); +	ver = (in_be16(&ccm->cir) & 0x003f);  	switch (msk) {  	case 0x6c:  		id = 52277; diff --git a/arch/m68k/cpu/mcf5227x/cpu_init.c b/arch/m68k/cpu/mcf5227x/cpu_init.c index beb78f583..e23b20df9 100644 --- a/arch/m68k/cpu/mcf5227x/cpu_init.c +++ b/arch/m68k/cpu/mcf5227x/cpu_init.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * (C) Copyright 2004-2007 Freescale Semiconductor, Inc. + * (C) Copyright 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -29,6 +29,7 @@  #include <watchdog.h>  #include <asm/immap.h> +#include <asm/io.h>  #include <asm/rtc.h>  /* @@ -40,70 +41,70 @@   */  void cpu_init_f(void)  { -	volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	volatile pll_t *pll = (volatile pll_t *)MMAP_PLL; +	scm1_t *scm1 = (scm1_t *) MMAP_SCM1; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	pll_t *pll = (pll_t *)MMAP_PLL;  #if !defined(CONFIG_CF_SBF)  	/* Workaround, must place before fbcs */ -	pll->psr = 0x12; +	out_be32(&pll->psr, 0x12); -	scm1->mpr = 0x77777777; -	scm1->pacra = 0; -	scm1->pacrb = 0; -	scm1->pacrc = 0; -	scm1->pacrd = 0; -	scm1->pacre = 0; -	scm1->pacrf = 0; -	scm1->pacrg = 0; -	scm1->pacri = 0; +	out_be32(&scm1->mpr, 0x77777777); +	out_be32(&scm1->pacra, 0); +	out_be32(&scm1->pacrb, 0); +	out_be32(&scm1->pacrc, 0); +	out_be32(&scm1->pacrd, 0); +	out_be32(&scm1->pacre, 0); +	out_be32(&scm1->pacrf, 0); +	out_be32(&scm1->pacrg, 0); +	out_be32(&scm1->pacri, 0);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \       && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #endif				/* CONFIG_CF_SBF */  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \       && defined(CONFIG_SYS_CS1_CTRL)) -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \       && defined(CONFIG_SYS_CS2_CTRL)) -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \       && defined(CONFIG_SYS_CS3_CTRL)) -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \       && defined(CONFIG_SYS_CS4_CTRL)) -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \       && defined(CONFIG_SYS_CS5_CTRL)) -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #ifdef CONFIG_FSL_I2C -	gpio->par_i2c = GPIO_PAR_I2C_SCL_SCL | GPIO_PAR_I2C_SDA_SDA; +	out_8(&gpio->par_i2c, GPIO_PAR_I2C_SCL_SCL | GPIO_PAR_I2C_SDA_SDA);  #endif  	icache_enable(); @@ -115,11 +116,11 @@ void cpu_init_f(void)  int cpu_init_r(void)  {  #ifdef CONFIG_MCFRTC -	volatile rtc_t *rtc = (volatile rtc_t *)(CONFIG_SYS_MCFRTC_BASE); -	volatile rtcex_t *rtcex = (volatile rtcex_t *)&rtc->extended; +	rtc_t *rtc = (rtc_t *)(CONFIG_SYS_MCFRTC_BASE); +	rtcex_t *rtcex = (rtcex_t *)&rtc->extended; -	rtcex->gocu = (CONFIG_SYS_RTC_OSCILLATOR >> 16) & 0xFFFF; -	rtcex->gocl = CONFIG_SYS_RTC_OSCILLATOR & 0xFFFF; +	out_be32(&rtcex->gocu, (CONFIG_SYS_RTC_OSCILLATOR >> 16) & 0xffff); +	out_be32(&rtcex->gocl, CONFIG_SYS_RTC_OSCILLATOR & 0xffff);  #endif  	return (0); @@ -127,27 +128,27 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= -		    (GPIO_PAR_UART_U0TXD_UNMASK & GPIO_PAR_UART_U0RXD_UNMASK); -		gpio->par_uart |= -		    (GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD); +		clrbits_be16(&gpio->par_uart, +			~(GPIO_PAR_UART_U0TXD_UNMASK & GPIO_PAR_UART_U0RXD_UNMASK)); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD);  		break;  	case 1: -		gpio->par_uart &= -		    (GPIO_PAR_UART_U1TXD_UNMASK & GPIO_PAR_UART_U1RXD_UNMASK); -		gpio->par_uart |= -		    (GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD); +		clrbits_be16(&gpio->par_uart, +			~(GPIO_PAR_UART_U1TXD_UNMASK & GPIO_PAR_UART_U1RXD_UNMASK)); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD);  		break;  	case 2: -		gpio->par_dspi &= -		    (GPIO_PAR_DSPI_SIN_UNMASK & GPIO_PAR_DSPI_SOUT_UNMASK); -		gpio->par_dspi = -		    (GPIO_PAR_DSPI_SIN_U2RXD | GPIO_PAR_DSPI_SOUT_U2TXD); +		clrbits_8(&gpio->par_dspi, +			~(GPIO_PAR_DSPI_SIN_UNMASK & GPIO_PAR_DSPI_SOUT_UNMASK)); +		out_8(&gpio->par_dspi, +			GPIO_PAR_DSPI_SIN_U2RXD | GPIO_PAR_DSPI_SOUT_U2TXD);  		break;  	}  } @@ -155,32 +156,32 @@ void uart_port_conf(int port)  #ifdef CONFIG_CF_DSPI  void cfspi_port_conf(void)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	gpio->par_dspi = -	    GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT | -	    GPIO_PAR_DSPI_SCK_SCK; +	out_8(&gpio->par_dspi, +		GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT | +		GPIO_PAR_DSPI_SCK_SCK);  }  int cfspi_claim_bus(uint bus, uint cs)  { -	volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	dspi_t *dspi = (dspi_t *) MMAP_DSPI; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	if ((dspi->sr & DSPI_SR_TXRXS) != DSPI_SR_TXRXS) +	if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS)  		return -1;  	/* Clear FIFO and resume transfer */ -	dspi->mcr &= ~(DSPI_MCR_CTXF | DSPI_MCR_CRXF); +	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);  	switch (cs) {  	case 0: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS0_UNMASK; -		gpio->par_dspi |= GPIO_PAR_DSPI_PCS0_PCS0; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_UNMASK); +		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);  		break;  	case 2: -		gpio->par_timer &= GPIO_PAR_TIMER_T2IN_UNMASK; -		gpio->par_timer |= GPIO_PAR_TIMER_T2IN_DSPIPCS2; +		clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK); +		setbits_8(&gpio->par_timer, GPIO_PAR_TIMER_T2IN_DSPIPCS2);  		break;  	} @@ -189,17 +190,18 @@ int cfspi_claim_bus(uint bus, uint cs)  void cfspi_release_bus(uint bus, uint cs)  { -	volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	dspi_t *dspi = (dspi_t *) MMAP_DSPI; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	dspi->mcr &= ~(DSPI_MCR_CTXF | DSPI_MCR_CRXF);	/* Clear FIFO */ +	/* Clear FIFO */ +	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);  	switch (cs) {  	case 0: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS0_PCS0; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);  		break;  	case 2: -		gpio->par_timer &= GPIO_PAR_TIMER_T2IN_UNMASK; +		clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);  		break;  	}  } diff --git a/arch/m68k/cpu/mcf5227x/interrupts.c b/arch/m68k/cpu/mcf5227x/interrupts.c index 85828a67b..a2cf51933 100644 --- a/arch/m68k/cpu/mcf5227x/interrupts.c +++ b/arch/m68k/cpu/mcf5227x/interrupts.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2004   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,14 +28,15 @@  /* CPU specific interrupt routine */  #include <common.h>  #include <asm/immap.h> +#include <asm/io.h>  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */ -	intp->imrh0 |= 0xFFFFFFFF; -	intp->imrl0 |= 0xFFFFFFFF; +	setbits_be32(&intp->imrh0, 0xffffffff); +	setbits_be32(&intp->imrl0, 0xffffffff);  	enable_interrupts();  	return 0; @@ -44,9 +45,9 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrh0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrh0, CONFIG_SYS_TMRINTR_MASK);  }  #endif diff --git a/arch/m68k/cpu/mcf5227x/speed.c b/arch/m68k/cpu/mcf5227x/speed.c index 7e385d399..b94a9eda4 100644 --- a/arch/m68k/cpu/mcf5227x/speed.c +++ b/arch/m68k/cpu/mcf5227x/speed.c @@ -1,6 +1,6 @@  /*   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -26,6 +26,7 @@  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR; @@ -44,7 +45,7 @@ DECLARE_GLOBAL_DATA_PTR;  void clock_enter_limp(int lpdiv)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; +	ccm_t *ccm = (ccm_t *)MMAP_CCM;  	int i, j;  	/* Check bounds of divider */ @@ -57,10 +58,10 @@ void clock_enter_limp(int lpdiv)  	for (i = 0, j = lpdiv; j != 1; j >>= 1, i++) ;  	/* Apply the divider to the system clock */ -	ccm->cdr = (ccm->cdr & 0xF0FF) | CCM_CDR_LPDIV(i); +	clrsetbits_be16(&ccm->cdr, 0x0f00, CCM_CDR_LPDIV(i));  	/* Enable Limp Mode */ -	ccm->misccr |= CCM_MISCCR_LIMP; +	setbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  }  /* @@ -69,14 +70,15 @@ void clock_enter_limp(int lpdiv)   */  void clock_exit_limp(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; -	volatile pll_t *pll = (volatile pll_t *)MMAP_PLL; +	ccm_t *ccm = (ccm_t *)MMAP_CCM; +	pll_t *pll = (pll_t *)MMAP_PLL;  	/* Exit Limp mode */ -	ccm->misccr &= ~CCM_MISCCR_LIMP; +	clrbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  	/* Wait for the PLL to lock */ -	while (!(pll->psr & PLL_PSR_LOCK)) ; +	while (!(in_be32(&pll->psr) & PLL_PSR_LOCK)) +		;  }  /* @@ -85,12 +87,12 @@ void clock_exit_limp(void)  int get_clocks(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; -	volatile pll_t *pll = (volatile pll_t *)MMAP_PLL; +	ccm_t *ccm = (ccm_t *)MMAP_CCM; +	pll_t *pll = (pll_t *)MMAP_PLL;  	int vco, temp, pcrvalue, pfdr;  	u8 bootmode; -	pcrvalue = pll->pcr & 0xFF0F0FFF; +	pcrvalue = in_be32(&pll->pcr) & 0xFF0F0FFF;  	pfdr = pcrvalue >> 24;  	if (pfdr == 0x1E) @@ -102,32 +104,32 @@ int get_clocks(void)  	if (bootmode == 0) {  		/* Normal mode */ -		vco = ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; +		vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;  		if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) {  			/* Default value */ -			pcrvalue = (pll->pcr & 0x00FFFFFF); +			pcrvalue = (in_be32(&pll->pcr) & 0x00FFFFFF);  			pcrvalue |= 0x1E << 24; -			pll->pcr = pcrvalue; +			out_be32(&pll->pcr, pcrvalue);  			vco = -			    ((pll->pcr & 0xFF000000) >> 24) * +			    ((in_be32(&pll->pcr) & 0xFF000000) >> 24) *  			    CONFIG_SYS_INPUT_CLKSRC;  		}  		gd->vco_clk = vco;	/* Vco clock */  	} else if (bootmode == 3) {  		/* serial mode */ -		vco = ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; +		vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;  		gd->vco_clk = vco;	/* Vco clock */  	} -	if ((ccm->ccr & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) { +	if ((in_be16(&ccm->ccr) & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) {  		/* Limp mode */  	} else {  		gd->inp_clk = CONFIG_SYS_INPUT_CLKSRC;	/* Input clock */ -		temp = (pll->pcr & PLL_PCR_OUTDIV1_MASK) + 1; +		temp = (in_be32(&pll->pcr) & PLL_PCR_OUTDIV1_MASK) + 1;  		gd->cpu_clk = vco / temp;	/* cpu clock */ -		temp = ((pll->pcr & PLL_PCR_OUTDIV2_MASK) >> 4) + 1; +		temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1;  		gd->flb_clk = vco / temp;	/* flexbus clock */  		gd->bus_clk = gd->flb_clk;  	} diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c index 2376f970d..a3f568403 100644 --- a/arch/m68k/cpu/mcf523x/cpu.c +++ b/arch/m68k/cpu/mcf523x/cpu.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -31,28 +31,29 @@  #include <netdev.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM; -	ccm->rcr = CCM_RCR_SOFTRST; +	out_8(&ccm->rcr, CCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; -}; +}  int checkcpu(void)  { -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM;  	u16 msk;  	u16 id = 0;  	u8 ver;  	puts("CPU:   "); -	msk = (ccm->cir >> 6); -	ver = (ccm->cir & 0x003f); +	msk = (in_be16(&ccm->cir) >> 6); +	ver = (in_be16(&ccm->cir) & 0x003f);  	switch (msk) {  	case 0x31:  		id = 5235; @@ -76,19 +77,21 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void watchdog_reset(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG); -	wdp->sr = 0x5555;	/* Count register */ +	/* Count register */ +	out_be16(&wdp->sr, 0x5555);  	asm("nop"); -	wdp->sr = 0xAAAA;	/* Count register */ +	out_be16(&wdp->sr, 0xaaaa);  }  int watchdog_disable(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);  	/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ -	wdp->cr |= WTM_WCR_HALTED;	/* halted watchdog timer */ +	/* halted watchdog timer */ +	setbits_be16(&wdp->cr, WTM_WCR_HALTED);  	puts("WATCHDOG:disabled\n");  	return (0); @@ -96,15 +99,15 @@ int watchdog_disable(void)  int watchdog_init(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);  	u32 wdog_module = 0;  	/* set timeout and enable watchdog */  	wdog_module = ((CONFIG_SYS_CLK / CONFIG_SYS_HZ) * CONFIG_WATCHDOG_TIMEOUT);  	wdog_module |= (wdog_module / 8192); -	wdp->mr = wdog_module; +	out_be16(&wdp->mr, wdog_module); -	wdp->cr = WTM_WCR_EN; +	out_be16(&wdp->cr, WTM_WCR_EN);  	puts("WATCHDOG:enabled\n");  	return (0); diff --git a/arch/m68k/cpu/mcf523x/cpu_init.c b/arch/m68k/cpu/mcf523x/cpu_init.c index 0f299f0c3..d1c0b401c 100644 --- a/arch/m68k/cpu/mcf523x/cpu_init.c +++ b/arch/m68k/cpu/mcf523x/cpu_init.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * (C) Copyright 2007 Freescale Semiconductor, Inc. + * (C) Copyright 2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,6 +28,7 @@  #include <common.h>  #include <watchdog.h>  #include <asm/immap.h> +#include <asm/io.h>  #if defined(CONFIG_CMD_NET)  #include <config.h> @@ -44,74 +45,74 @@   */  void cpu_init_f(void)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	volatile wdog_t *wdog = (wdog_t *) MMAP_WDOG; -	volatile scm_t *scm = (scm_t *) MMAP_SCM; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	wdog_t *wdog = (wdog_t *) MMAP_WDOG; +	scm_t *scm = (scm_t *) MMAP_SCM;  	/* watchdog is enabled by default - disable the watchdog */  #ifndef CONFIG_WATCHDOG -	wdog->cr = 0; +	out_be16(&wdog->cr, 0);  #endif -	scm->rambar = (CONFIG_SYS_INIT_RAM_ADDR | SCM_RAMBAR_BDE); +	out_be32(&scm->rambar, CONFIG_SYS_INIT_RAM_ADDR | SCM_RAMBAR_BDE);  	/* Port configuration */ -	gpio->par_cs = 0; +	out_8(&gpio->par_cs, 0);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) && defined(CONFIG_SYS_CS1_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS1; -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS1); +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) && defined(CONFIG_SYS_CS2_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS2; -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS2); +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) && defined(CONFIG_SYS_CS3_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS3; -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS3); +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) && defined(CONFIG_SYS_CS4_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS4; -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS4); +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) && defined(CONFIG_SYS_CS5_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS5; -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS5); +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #if (defined(CONFIG_SYS_CS6_BASE) && defined(CONFIG_SYS_CS6_MASK) && defined(CONFIG_SYS_CS6_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS6; -	fbcs->csar6 = CONFIG_SYS_CS6_BASE; -	fbcs->cscr6 = CONFIG_SYS_CS6_CTRL; -	fbcs->csmr6 = CONFIG_SYS_CS6_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS6); +	out_be32(&fbcs->csar6, CONFIG_SYS_CS6_BASE); +	out_be32(&fbcs->cscr6, CONFIG_SYS_CS6_CTRL); +	out_be32(&fbcs->csmr6, CONFIG_SYS_CS6_MASK);  #endif  #if (defined(CONFIG_SYS_CS7_BASE) && defined(CONFIG_SYS_CS7_MASK) && defined(CONFIG_SYS_CS7_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS_CS7; -	fbcs->csar7 = CONFIG_SYS_CS7_BASE; -	fbcs->cscr7 = CONFIG_SYS_CS7_CTRL; -	fbcs->csmr7 = CONFIG_SYS_CS7_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS_CS7); +	out_be32(&fbcs->csar7, CONFIG_SYS_CS7_BASE); +	out_be32(&fbcs->cscr7, CONFIG_SYS_CS7_CTRL); +	out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK);  #endif  #ifdef CONFIG_FSL_I2C @@ -132,29 +133,33 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= ~(GPIO_PAR_UART_U0RXD | GPIO_PAR_UART_U0TXD); -		gpio->par_uart |= (GPIO_PAR_UART_U0RXD | GPIO_PAR_UART_U0TXD); +		clrbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U0RXD | GPIO_PAR_UART_U0TXD); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U0RXD | GPIO_PAR_UART_U0TXD);  		break;  	case 1: -		gpio->par_uart &= -		    ~(GPIO_PAR_UART_U1RXD_MASK | GPIO_PAR_UART_U1TXD_MASK); -		gpio->par_uart |= -		    (GPIO_PAR_UART_U1RXD_U1RXD | GPIO_PAR_UART_U1TXD_U1TXD); +		clrbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U1RXD_MASK | GPIO_PAR_UART_U1TXD_MASK); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U1RXD_U1RXD | GPIO_PAR_UART_U1TXD_U1TXD);  		break;  	case 2:  #ifdef CONFIG_SYS_UART2_PRI_GPIO -		gpio->par_uart &= ~(GPIO_PAR_UART_U2RXD | GPIO_PAR_UART_U2TXD); -		gpio->par_uart |= (GPIO_PAR_UART_U2RXD | GPIO_PAR_UART_U2TXD); +		clrbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U2RXD | GPIO_PAR_UART_U2TXD); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_U2RXD | GPIO_PAR_UART_U2TXD);  #elif defined(CONFIG_SYS_UART2_ALT1_GPIO) -		gpio->feci2c &= -		    ~(GPIO_PAR_FECI2C_EMDC_MASK | GPIO_PAR_FECI2C_EMDIO_MASK); -		gpio->feci2c |= -		    (GPIO_PAR_FECI2C_EMDC_U2TXD | GPIO_PAR_FECI2C_EMDIO_U2RXD); +		clrbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_EMDC_MASK | GPIO_PAR_FECI2C_EMDIO_MASK); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_EMDC_U2TXD | GPIO_PAR_FECI2C_EMDIO_U2RXD);  #endif  		break;  	} @@ -163,15 +168,16 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	if (setclear) { -		gpio->par_feci2c |= -		    (GPIO_PAR_FECI2C_EMDC_FECEMDC | -		     GPIO_PAR_FECI2C_EMDIO_FECEMDIO); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_EMDC_FECEMDC | +			GPIO_PAR_FECI2C_EMDIO_FECEMDIO);  	} else { -		gpio->par_feci2c &= -		    ~(GPIO_PAR_FECI2C_EMDC_MASK | GPIO_PAR_FECI2C_EMDIO_MASK); +		clrbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_EMDC_MASK | +			GPIO_PAR_FECI2C_EMDIO_MASK);  	}  	return 0; diff --git a/arch/m68k/cpu/mcf523x/interrupts.c b/arch/m68k/cpu/mcf523x/interrupts.c index db5ccdf6d..76115a401 100644 --- a/arch/m68k/cpu/mcf523x/interrupts.c +++ b/arch/m68k/cpu/mcf523x/interrupts.c @@ -1,6 +1,6 @@  /*   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -25,13 +25,14 @@  /* CPU specific interrupt routine */  #include <common.h>  #include <asm/immap.h> +#include <asm/io.h>  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */ -	intp->imrl0 |= 0x1; +	setbits_be32(&intp->imrl0, 0x1);  	enable_interrupts();  	return 0; @@ -40,10 +41,10 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrl0 &= ~INTC_IPRL_INT0; -	intp->imrl0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrl0, INTC_IPRL_INT0); +	clrbits_be32(&intp->imrl0, CONFIG_SYS_TMRINTR_MASK);  }  #endif diff --git a/arch/m68k/cpu/mcf523x/speed.c b/arch/m68k/cpu/mcf523x/speed.c index 6096ba414..e2a6ae3a5 100644 --- a/arch/m68k/cpu/mcf523x/speed.c +++ b/arch/m68k/cpu/mcf523x/speed.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -29,6 +29,7 @@  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  /* @@ -36,11 +37,12 @@ DECLARE_GLOBAL_DATA_PTR;   */  int get_clocks(void)  { -	volatile pll_t *pll = (volatile pll_t *)(MMAP_PLL); +	pll_t *pll = (pll_t *)(MMAP_PLL); -	pll->syncr = PLL_SYNCR_MFD(1); +	out_be32(&pll->syncr, PLL_SYNCR_MFD(1)); -	while (!(pll->synsr & PLL_SYNSR_LOCK)); +	while (!(in_be32(&pll->synsr) & PLL_SYNSR_LOCK)) +		;  	gd->bus_clk = CONFIG_SYS_CLK;  	gd->cpu_clk = (gd->bus_clk * 2); diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c index 571d078f8..7c6100c52 100644 --- a/arch/m68k/cpu/mcf52x2/cpu.c +++ b/arch/m68k/cpu/mcf52x2/cpu.c @@ -9,6 +9,8 @@   * MCF5275 additions   * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.com)   * + * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved. + *   * See file CREDITS for list of people who contributed to this   * project.   * @@ -32,6 +34,7 @@  #include <watchdog.h>  #include <command.h>  #include <asm/immap.h> +#include <asm/io.h>  #include <netdev.h>  #include "cpu.h" @@ -40,11 +43,11 @@ DECLARE_GLOBAL_DATA_PTR;  #ifdef	CONFIG_M5208  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM); +	rcm_t *rcm = (rcm_t *)(MMAP_RCM);  	udelay(1000); -	rcm->rcr = RCM_RCR_SOFTRST; +	out_8(&rcm->rcr, RCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; @@ -65,18 +68,21 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void watchdog_reset(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); -	wdt->sr = 0x5555; -	wdt->sr = 0xAAAA; +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); + +	out_be16(&wdt->sr, 0x5555); +	out_be16(&wdt->sr, 0xaaaa);  }  int watchdog_disable(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->sr = 0x5555; /* reset watchdog counter */ -	wdt->sr = 0xAAAA; -	wdt->cr = 0;	/* disable watchdog timer */ +	/* reset watchdog counter */ +	out_be16(&wdt->sr, 0x5555); +	out_be16(&wdt->sr, 0xaaaa); +	/* disable watchdog timer */ +	out_be16(&wdt->cr, 0);  	puts("WATCHDOG:disabled\n");  	return (0); @@ -84,15 +90,18 @@ int watchdog_disable(void)  int watchdog_init(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->cr = 0;	/* disable watchdog */ +	/* disable watchdog */ +	out_be16(&wdt->cr, 0);  	/* set timeout and enable watchdog */ -	wdt->mr = -		((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; -	wdt->sr = 0x5555; /* reset watchdog counter */ -	wdt->sr = 0xAAAA; +	out_be16(&wdt->mr, +		(CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1); + +	/* reset watchdog counter */ +	out_be16(&wdt->sr, 0x5555); +	out_be16(&wdt->sr, 0xaaaa);  	puts("WATCHDOG:enabled\n");  	return (0); @@ -178,13 +187,13 @@ int watchdog_init(void)  #ifdef	CONFIG_M5272  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG); -	wdp->wdog_wrrr = 0; +	out_be16(&wdp->wdog_wrrr, 0);  	udelay(1000);  	/* enable watchdog, set timeout to 0 and wait */ -	wdp->wdog_wrrr = 1; +	out_be16(&wdp->wdog_wrrr, 1);  	while (1) ;  	/* we don't return! */ @@ -193,12 +202,12 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int checkcpu(void)  { -	volatile sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG); +	sysctrl_t *sysctrl = (sysctrl_t *) (MMAP_CFG);  	uchar msk;  	char *suf;  	puts("CPU:   "); -	msk = (sysctrl->sc_dir > 28) & 0xf; +	msk = (in_be32(&sysctrl->sc_dir) > 28) & 0xf;  	switch (msk) {  	case 0x2:  		suf = "1K75N"; @@ -221,17 +230,21 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void watchdog_reset(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); -	wdt->wdog_wcr = 0; +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); + +	out_be16(&wdt->wdog_wcr, 0);  }  int watchdog_disable(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->wdog_wcr = 0;	/* reset watchdog counter */ -	wdt->wdog_wirr = 0;	/* disable watchdog interrupt */ -	wdt->wdog_wrrr = 0;	/* disable watchdog timer */ +	/* reset watchdog counter */ +	out_be16(&wdt->wdog_wcr, 0); +	/* disable watchdog interrupt */ +	out_be16(&wdt->wdog_wirr, 0); +	/* disable watchdog timer */ +	out_be16(&wdt->wdog_wrrr, 0);  	puts("WATCHDOG:disabled\n");  	return (0); @@ -239,14 +252,17 @@ int watchdog_disable(void)  int watchdog_init(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->wdog_wirr = 0;	/* disable watchdog interrupt */ +	/* disable watchdog interrupt */ +	out_be16(&wdt->wdog_wirr, 0);  	/* set timeout and enable watchdog */ -	wdt->wdog_wrrr = -	    ((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; -	wdt->wdog_wcr = 0;	/* reset watchdog counter */ +	out_be16(&wdt->wdog_wrrr, +		(CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1); + +	/* reset watchdog counter */ +	out_be16(&wdt->wdog_wcr, 0);  	puts("WATCHDOG:enabled\n");  	return (0); @@ -258,11 +274,11 @@ int watchdog_init(void)  #ifdef	CONFIG_M5275  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile rcm_t *rcm = (rcm_t *)(MMAP_RCM); +	rcm_t *rcm = (rcm_t *)(MMAP_RCM);  	udelay(1000); -	rcm->rcr = RCM_RCR_SOFTRST; +	out_8(&rcm->rcr, RCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; @@ -282,18 +298,22 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void watchdog_reset(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); -	wdt->wsr = 0x5555; -	wdt->wsr = 0xAAAA; +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); + +	out_be16(&wdt->wsr, 0x5555); +	out_be16(&wdt->wsr, 0xaaaa);  }  int watchdog_disable(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->wsr = 0x5555; /* reset watchdog counter */ -	wdt->wsr = 0xAAAA; -	wdt->wcr = 0;	/* disable watchdog timer */ +	/* reset watchdog counter */ +	out_be16(&wdt->wsr, 0x5555); +	out_be16(&wdt->wsr, 0xaaaa); + +	/* disable watchdog timer */ +	out_be16(&wdt->wcr, 0);  	puts("WATCHDOG:disabled\n");  	return (0); @@ -301,15 +321,18 @@ int watchdog_disable(void)  int watchdog_init(void)  { -	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG); +	wdog_t *wdt = (wdog_t *)(MMAP_WDOG); -	wdt->wcr = 0;	/* disable watchdog */ +	/* disable watchdog */ +	out_be16(&wdt->wcr, 0);  	/* set timeout and enable watchdog */ -	wdt->wmr = -		((CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000)) - 1; -	wdt->wsr = 0x5555; /* reset watchdog counter */ -	wdt->wsr = 0xAAAA; +	out_be16(&wdt->wmr, +		(CONFIG_WATCHDOG_TIMEOUT * CONFIG_SYS_HZ) / (32768 * 1000) - 1); + +	/* reset watchdog counter */ +	out_be16(&wdt->wsr, 0x5555); +	out_be16(&wdt->wsr, 0xaaaa);  	puts("WATCHDOG:enabled\n");  	return (0); diff --git a/arch/m68k/cpu/mcf52x2/cpu_init.c b/arch/m68k/cpu/mcf52x2/cpu_init.c index a98a9262e..5d0e9f06f 100644 --- a/arch/m68k/cpu/mcf52x2/cpu_init.c +++ b/arch/m68k/cpu/mcf52x2/cpu_init.c @@ -8,7 +8,7 @@   * (c) Copyright 2010   * Arcturus Networks Inc. <www.arcturusnetworks.com>   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   * Hayden Fraser (Hayden.Fraser@freescale.com)   * @@ -37,6 +37,7 @@  #include <common.h>  #include <watchdog.h>  #include <asm/immap.h> +#include <asm/io.h>  #if defined(CONFIG_CMD_NET)  #include <config.h> @@ -48,57 +49,57 @@  /* Only 5272 Flexbus chipselect is different from the rest */  void init_fbcs(void)  { -	volatile fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS); +	fbcs_t *fbcs = (fbcs_t *) (MMAP_FBCS);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \       && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #else  #warning "Chip Select 0 are not initialized/used"  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \       && defined(CONFIG_SYS_CS1_CTRL)) -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \       && defined(CONFIG_SYS_CS2_CTRL)) -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \       && defined(CONFIG_SYS_CS3_CTRL)) -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \       && defined(CONFIG_SYS_CS4_CTRL)) -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \       && defined(CONFIG_SYS_CS5_CTRL)) -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #if (defined(CONFIG_SYS_CS6_BASE) && defined(CONFIG_SYS_CS6_MASK) \       && defined(CONFIG_SYS_CS6_CTRL)) -	fbcs->csar6 = CONFIG_SYS_CS6_BASE; -	fbcs->cscr6 = CONFIG_SYS_CS6_CTRL; -	fbcs->csmr6 = CONFIG_SYS_CS6_MASK; +	out_be32(&fbcs->csar6, CONFIG_SYS_CS6_BASE); +	out_be32(&fbcs->cscr6, CONFIG_SYS_CS6_CTRL); +	out_be32(&fbcs->csmr6, CONFIG_SYS_CS6_MASK);  #endif  #if (defined(CONFIG_SYS_CS7_BASE) && defined(CONFIG_SYS_CS7_MASK) \       && defined(CONFIG_SYS_CS7_CTRL)) -	fbcs->csar7 = CONFIG_SYS_CS7_BASE; -	fbcs->cscr7 = CONFIG_SYS_CS7_CTRL; -	fbcs->csmr7 = CONFIG_SYS_CS7_MASK; +	out_be32(&fbcs->csar7, CONFIG_SYS_CS7_BASE); +	out_be32(&fbcs->cscr7, CONFIG_SYS_CS7_CTRL); +	out_be32(&fbcs->csmr7, CONFIG_SYS_CS7_MASK);  #endif  }  #endif @@ -106,22 +107,22 @@ void init_fbcs(void)  #if defined(CONFIG_M5208)  void cpu_init_f(void)  { -	volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1; +	scm1_t *scm1 = (scm1_t *) MMAP_SCM1;  #ifndef CONFIG_WATCHDOG -	volatile wdog_t *wdg = (wdog_t *) MMAP_WDOG; +	wdog_t *wdg = (wdog_t *) MMAP_WDOG;  	/* Disable the watchdog if we aren't using it */ -	wdg->cr = 0; +	out_be16(&wdg->cr, 0);  #endif -	scm1->mpr = 0x77777777; -	scm1->pacra = 0; -	scm1->pacrb = 0; -	scm1->pacrc = 0; -	scm1->pacrd = 0; -	scm1->pacre = 0; -	scm1->pacrf = 0; +	out_be32(&scm1->mpr, 0x77777777); +	out_be32(&scm1->pacra, 0); +	out_be32(&scm1->pacrb, 0); +	out_be32(&scm1->pacrc, 0); +	out_be32(&scm1->pacrd, 0); +	out_be32(&scm1->pacre, 0); +	out_be32(&scm1->pacrf, 0);  	/* FlexBus Chipselect */  	init_fbcs(); @@ -137,36 +138,36 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= GPIO_PAR_UART0_UNMASK; -		gpio->par_uart |= (GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD); +		clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK); +		setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);  		break;  	case 1: -		gpio->par_uart &= GPIO_PAR_UART0_UNMASK; -		gpio->par_uart |= (GPIO_PAR_UART_U1TXD | GPIO_PAR_UART_U1RXD); +		clrbits_be16(&gpio->par_uart, ~GPIO_PAR_UART0_UNMASK); +		setbits_be16(&gpio->par_uart, GPIO_PAR_UART_U1TXD | GPIO_PAR_UART_U1RXD);  		break;  	case 2:  #ifdef CONFIG_SYS_UART2_PRI_GPIO -		gpio->par_timer &= -		    (GPIO_PAR_TMR_TIN0_UNMASK | GPIO_PAR_TMR_TIN1_UNMASK); -		gpio->par_timer |= -		    (GPIO_PAR_TMR_TIN0_U2TXD | GPIO_PAR_TMR_TIN1_U2RXD); +		clrbits_8(&gpio->par_timer, +			~(GPIO_PAR_TMR_TIN0_UNMASK | GPIO_PAR_TMR_TIN1_UNMASK)); +		setbits_8(&gpio->par_timer, +			GPIO_PAR_TMR_TIN0_U2TXD | GPIO_PAR_TMR_TIN1_U2RXD);  #endif  #ifdef CONFIG_SYS_UART2_ALT1_GPIO -		gpio->par_feci2c &= -		    (GPIO_PAR_FECI2C_MDC_UNMASK | GPIO_PAR_FECI2C_MDIO_UNMASK); -		gpio->par_feci2c |= -		    (GPIO_PAR_FECI2C_MDC_U2TXD | GPIO_PAR_FECI2C_MDIO_U2RXD); +		clrbits_8(&gpio->par_feci2c, +			~(GPIO_PAR_FECI2C_MDC_UNMASK | GPIO_PAR_FECI2C_MDIO_UNMASK)); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC_U2TXD | GPIO_PAR_FECI2C_MDIO_U2RXD);  #endif  #ifdef CONFIG_SYS_UART2_ALT1_GPIO -		gpio->par_feci2c &= -		    (GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK); -		gpio->par_feci2c |= -		    (GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD); +		clrbits_8(&gpio->par_feci2c, +			~(GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK)); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD);  #endif  		break;  	} @@ -175,17 +176,17 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	if (setclear) { -		gpio->par_fec |= -		    GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC; -		gpio->par_feci2c |= -		    GPIO_PAR_FECI2C_MDC_MDC | GPIO_PAR_FECI2C_MDIO_MDIO; +		setbits_8(&gpio->par_fec, +			GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC_MDC | GPIO_PAR_FECI2C_MDIO_MDIO);  	} else { -		gpio->par_fec &= -		    (GPIO_PAR_FEC_7W_UNMASK & GPIO_PAR_FEC_MII_UNMASK); -		gpio->par_feci2c &= GPIO_PAR_FECI2C_RMII_UNMASK; +		clrbits_8(&gpio->par_fec, +			~(GPIO_PAR_FEC_7W_UNMASK & GPIO_PAR_FEC_MII_UNMASK)); +		clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII_UNMASK);  	}  	return 0;  } @@ -249,17 +250,17 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile u32 *par = (u32 *) MMAP_PAR; +	u32 *par = (u32 *) MMAP_PAR;  	/* Setup Ports: */  	switch (port) {  	case 1: -		*par &= 0xFFE7FFFF; -		*par |= 0x00180000; +		clrbits_be32(par, 0x00180000); +		setbits_be32(par, 0x00180000);  		break;  	case 2: -		*par &= 0xFFFFFFFC; -		*par &= 0x00000003; +		clrbits_be32(par, 0x00000003); +		clrbits_be32(par, 0xFFFFFFFC);  		break;  	}  } @@ -332,7 +333,20 @@ int fecpin_setclear(struct eth_device *dev, int setclear)  	return 0;  }  #endif				/* CONFIG_CMD_NET */ -#endif + +#if defined(CONFIG_CF_QSPI) + +/* Configure PIOs for SIN, SOUT, and SCK */ +void cfspi_port_conf(void) +{ +	mbar_writeByte(MCF_GPIO_PAR_QSPI, +		       MCF_GPIO_PAR_QSPI_SIN_SIN   | +		       MCF_GPIO_PAR_QSPI_SOUT_SOUT | +		       MCF_GPIO_PAR_QSPI_SCK_SCK); +} +#endif				/* CONFIG_CF_QSPI */ + +#endif				/* CONFIG_M5271 */  #if defined(CONFIG_M5272)  /* @@ -348,59 +362,59 @@ void cpu_init_f(void)  	 * already initialized.  	 */  #ifndef CONFIG_MONITOR_IS_IN_RAM -	volatile sysctrl_t *sysctrl = (sysctrl_t *) (CONFIG_SYS_MBAR); -	volatile gpio_t *gpio = (gpio_t *) (MMAP_GPIO); -	volatile csctrl_t *csctrl = (csctrl_t *) (MMAP_FBCS); +	sysctrl_t *sysctrl = (sysctrl_t *) (CONFIG_SYS_MBAR); +	gpio_t *gpio = (gpio_t *) (MMAP_GPIO); +	csctrl_t *csctrl = (csctrl_t *) (MMAP_FBCS); -	sysctrl->sc_scr = CONFIG_SYS_SCR; -	sysctrl->sc_spr = CONFIG_SYS_SPR; +	out_be16(&sysctrl->sc_scr, CONFIG_SYS_SCR); +	out_be16(&sysctrl->sc_spr, CONFIG_SYS_SPR);  	/* Setup Ports: */ -	gpio->gpio_pacnt = CONFIG_SYS_PACNT; -	gpio->gpio_paddr = CONFIG_SYS_PADDR; -	gpio->gpio_padat = CONFIG_SYS_PADAT; -	gpio->gpio_pbcnt = CONFIG_SYS_PBCNT; -	gpio->gpio_pbddr = CONFIG_SYS_PBDDR; -	gpio->gpio_pbdat = CONFIG_SYS_PBDAT; -	gpio->gpio_pdcnt = CONFIG_SYS_PDCNT; +	out_be32(&gpio->gpio_pacnt, CONFIG_SYS_PACNT); +	out_be16(&gpio->gpio_paddr, CONFIG_SYS_PADDR); +	out_be16(&gpio->gpio_padat, CONFIG_SYS_PADAT); +	out_be32(&gpio->gpio_pbcnt, CONFIG_SYS_PBCNT); +	out_be16(&gpio->gpio_pbddr, CONFIG_SYS_PBDDR); +	out_be16(&gpio->gpio_pbdat, CONFIG_SYS_PBDAT); +	out_be32(&gpio->gpio_pdcnt, CONFIG_SYS_PDCNT);  	/* Memory Controller: */ -	csctrl->cs_br0 = CONFIG_SYS_BR0_PRELIM; -	csctrl->cs_or0 = CONFIG_SYS_OR0_PRELIM; +	out_be32(&csctrl->cs_br0, CONFIG_SYS_BR0_PRELIM); +	out_be32(&csctrl->cs_or0, CONFIG_SYS_OR0_PRELIM);  #if (defined(CONFIG_SYS_OR1_PRELIM) && defined(CONFIG_SYS_BR1_PRELIM)) -	csctrl->cs_br1 = CONFIG_SYS_BR1_PRELIM; -	csctrl->cs_or1 = CONFIG_SYS_OR1_PRELIM; +	out_be32(&csctrl->cs_br1, CONFIG_SYS_BR1_PRELIM); +	out_be32(&csctrl->cs_or1, CONFIG_SYS_OR1_PRELIM);  #endif  #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM) -	csctrl->cs_br2 = CONFIG_SYS_BR2_PRELIM; -	csctrl->cs_or2 = CONFIG_SYS_OR2_PRELIM; +	out_be32(&csctrl->cs_br2, CONFIG_SYS_BR2_PRELIM); +	out_be32(&csctrl->cs_or2, CONFIG_SYS_OR2_PRELIM);  #endif  #if defined(CONFIG_SYS_OR3_PRELIM) && defined(CONFIG_SYS_BR3_PRELIM) -	csctrl->cs_br3 = CONFIG_SYS_BR3_PRELIM; -	csctrl->cs_or3 = CONFIG_SYS_OR3_PRELIM; +	out_be32(&csctrl->cs_br3, CONFIG_SYS_BR3_PRELIM); +	out_be32(&csctrl->cs_or3, CONFIG_SYS_OR3_PRELIM);  #endif  #if defined(CONFIG_SYS_OR4_PRELIM) && defined(CONFIG_SYS_BR4_PRELIM) -	csctrl->cs_br4 = CONFIG_SYS_BR4_PRELIM; -	csctrl->cs_or4 = CONFIG_SYS_OR4_PRELIM; +	out_be32(&csctrl->cs_br4, CONFIG_SYS_BR4_PRELIM); +	out_be32(&csctrl->cs_or4, CONFIG_SYS_OR4_PRELIM);  #endif  #if defined(CONFIG_SYS_OR5_PRELIM) && defined(CONFIG_SYS_BR5_PRELIM) -	csctrl->cs_br5 = CONFIG_SYS_BR5_PRELIM; -	csctrl->cs_or5 = CONFIG_SYS_OR5_PRELIM; +	out_be32(&csctrl->cs_br5, CONFIG_SYS_BR5_PRELIM); +	out_be32(&csctrl->cs_or5, CONFIG_SYS_OR5_PRELIM);  #endif  #if defined(CONFIG_SYS_OR6_PRELIM) && defined(CONFIG_SYS_BR6_PRELIM) -	csctrl->cs_br6 = CONFIG_SYS_BR6_PRELIM; -	csctrl->cs_or6 = CONFIG_SYS_OR6_PRELIM; +	out_be32(&csctrl->cs_br6, CONFIG_SYS_BR6_PRELIM); +	out_be32(&csctrl->cs_or6, CONFIG_SYS_OR6_PRELIM);  #endif  #if defined(CONFIG_SYS_OR7_PRELIM) && defined(CONFIG_SYS_BR7_PRELIM) -	csctrl->cs_br7 = CONFIG_SYS_BR7_PRELIM; -	csctrl->cs_or7 = CONFIG_SYS_OR7_PRELIM; +	out_be32(&csctrl->cs_br7, CONFIG_SYS_BR7_PRELIM); +	out_be32(&csctrl->cs_or7, CONFIG_SYS_OR7_PRELIM);  #endif  #endif				/* #ifndef CONFIG_MONITOR_IS_IN_RAM */ @@ -420,17 +434,21 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->gpio_pbcnt &= ~(GPIO_PBCNT_PB0MSK | GPIO_PBCNT_PB1MSK); -		gpio->gpio_pbcnt |= (GPIO_PBCNT_URT0_TXD | GPIO_PBCNT_URT0_RXD); +		clrbits_be32(&gpio->gpio_pbcnt, +			GPIO_PBCNT_PB0MSK | GPIO_PBCNT_PB1MSK); +		setbits_be32(&gpio->gpio_pbcnt, +			GPIO_PBCNT_URT0_TXD | GPIO_PBCNT_URT0_RXD);  		break;  	case 1: -		gpio->gpio_pdcnt &= ~(GPIO_PDCNT_PD1MSK | GPIO_PDCNT_PD4MSK); -		gpio->gpio_pdcnt |= (GPIO_PDCNT_URT1_RXD | GPIO_PDCNT_URT1_TXD); +		clrbits_be32(&gpio->gpio_pdcnt, +			GPIO_PDCNT_PD1MSK | GPIO_PDCNT_PD4MSK); +		setbits_be32(&gpio->gpio_pdcnt, +			GPIO_PDCNT_URT1_RXD | GPIO_PDCNT_URT1_TXD);  		break;  	}  } @@ -438,13 +456,14 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	if (setclear) { -		gpio->gpio_pbcnt |= GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER | -				    GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 | -				    GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 | -				    GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3; +		setbits_be32(&gpio->gpio_pbcnt, +			GPIO_PBCNT_E_MDC | GPIO_PBCNT_E_RXER | +			GPIO_PBCNT_E_RXD1 | GPIO_PBCNT_E_RXD2 | +			GPIO_PBCNT_E_RXD3 | GPIO_PBCNT_E_TXD1 | +			GPIO_PBCNT_E_TXD2 | GPIO_PBCNT_E_TXD3);  	} else {  	}  	return 0; @@ -469,11 +488,11 @@ void cpu_init_f(void)  	 */  #ifndef CONFIG_MONITOR_IS_IN_RAM -	volatile wdog_t *wdog_reg = (wdog_t *) (MMAP_WDOG); -	volatile gpio_t *gpio_reg = (gpio_t *) (MMAP_GPIO); +	wdog_t *wdog_reg = (wdog_t *) (MMAP_WDOG); +	gpio_t *gpio_reg = (gpio_t *) (MMAP_GPIO);  	/* Kill watchdog so we can initialize the PLL */ -	wdog_reg->wcr = 0; +	out_be16(&wdog_reg->wcr, 0);  	/* FlexBus Chipselect */  	init_fbcs(); @@ -498,21 +517,21 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= ~UART0_ENABLE_MASK; -		gpio->par_uart |= UART0_ENABLE_MASK; +		clrbits_be16(&gpio->par_uart, UART0_ENABLE_MASK); +		setbits_be16(&gpio->par_uart, UART0_ENABLE_MASK);  		break;  	case 1: -		gpio->par_uart &= ~UART1_ENABLE_MASK; -		gpio->par_uart |= UART1_ENABLE_MASK; +		clrbits_be16(&gpio->par_uart, UART1_ENABLE_MASK); +		setbits_be16(&gpio->par_uart, UART1_ENABLE_MASK);  		break;  	case 2: -		gpio->par_uart &= ~UART2_ENABLE_MASK; -		gpio->par_uart |= UART2_ENABLE_MASK; +		clrbits_be16(&gpio->par_uart, UART2_ENABLE_MASK); +		setbits_be16(&gpio->par_uart, UART2_ENABLE_MASK);  		break;  	}  } @@ -521,24 +540,24 @@ void uart_port_conf(int port)  int fecpin_setclear(struct eth_device *dev, int setclear)  {  	struct fec_info_s *info = (struct fec_info_s *) dev->priv; -	volatile gpio_t *gpio = (gpio_t *)MMAP_GPIO; +	gpio_t *gpio = (gpio_t *)MMAP_GPIO;  	if (setclear) {  		/* Enable Ethernet pins */  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) { -			gpio->par_feci2c |= 0x0F00; -			gpio->par_fec0hl |= 0xC0; +			setbits_be16(&gpio->par_feci2c, 0x0f00); +			setbits_8(&gpio->par_fec0hl, 0xc0);  		} else { -			gpio->par_feci2c |= 0x00A0; -			gpio->par_fec1hl |= 0xC0; +			setbits_be16(&gpio->par_feci2c, 0x00a0); +			setbits_8(&gpio->par_fec1hl, 0xc0);  		}  	} else {  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) { -			gpio->par_feci2c &= ~0x0F00; -			gpio->par_fec0hl &= ~0xC0; +			clrbits_be16(&gpio->par_feci2c, 0x0f00); +			clrbits_8(&gpio->par_fec0hl, 0xc0);  		} else { -			gpio->par_feci2c &= ~0x00A0; -			gpio->par_fec1hl &= ~0xC0; +			clrbits_be16(&gpio->par_feci2c, 0x00a0); +			clrbits_8(&gpio->par_fec1hl, 0xc0);  		}  	} diff --git a/arch/m68k/cpu/mcf52x2/interrupts.c b/arch/m68k/cpu/mcf52x2/interrupts.c index dff8c6aa8..915eb7023 100644 --- a/arch/m68k/cpu/mcf52x2/interrupts.c +++ b/arch/m68k/cpu/mcf52x2/interrupts.c @@ -2,7 +2,7 @@   * (C) Copyright 2000-2004   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,20 +28,22 @@  #include <watchdog.h>  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  #ifdef	CONFIG_M5272  int interrupt_init(void)  { -	volatile intctrl_t *intp = (intctrl_t *) (MMAP_INTC); +	intctrl_t *intp = (intctrl_t *) (MMAP_INTC);  	/* disable all external interrupts */ -	intp->int_icr1 = 0x88888888; -	intp->int_icr2 = 0x88888888; -	intp->int_icr3 = 0x88888888; -	intp->int_icr4 = 0x88888888; -	intp->int_pitr = 0x00000000; +	out_be32(&intp->int_icr1, 0x88888888); +	out_be32(&intp->int_icr2, 0x88888888); +	out_be32(&intp->int_icr3, 0x88888888); +	out_be32(&intp->int_icr4, 0x88888888); +	out_be32(&intp->int_pitr, 0x00000000); +  	/* initialize vector register */ -	intp->int_pivr = 0x40; +	out_8(&intp->int_pivr, 0x40);  	enable_interrupts(); @@ -51,10 +53,10 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE); +	intctrl_t *intp = (intctrl_t *) (CONFIG_SYS_INTR_BASE); -	intp->int_icr1 &= ~INT_ICR1_TMR3MASK; -	intp->int_icr1 |= CONFIG_SYS_TMRINTR_PRI; +	clrbits_be32(&intp->int_icr1, INT_ICR1_TMR3MASK); +	setbits_be32(&intp->int_icr1, CONFIG_SYS_TMRINTR_PRI);  }  #endif				/* CONFIG_MCFTMR */  #endif				/* CONFIG_M5272 */ @@ -63,14 +65,14 @@ void dtimer_intr_setup(void)      defined(CONFIG_M5271) || defined(CONFIG_M5275)  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */  #if defined(CONFIG_M5208) -	intp->imrl0 = 0xFFFFFFFF; -	intp->imrh0 = 0xFFFFFFFF; +	out_be32(&intp->imrl0, 0xffffffff); +	out_be32(&intp->imrh0, 0xffffffff);  #else -	intp->imrl0 |= 0x1; +	setbits_be32(&intp->imrl0, 0x1);  #endif  	enable_interrupts(); @@ -80,11 +82,11 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrl0 &= 0xFFFFFFFE; -	intp->imrl0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrl0, 0x00000001); +	clrbits_be32(&intp->imrl0, CONFIG_SYS_TMRINTR_MASK);  }  #endif				/* CONFIG_MCFTMR */  #endif				/* CONFIG_M5282 | CONFIG_M5271 | CONFIG_M5275 */ diff --git a/arch/m68k/cpu/mcf52x2/speed.c b/arch/m68k/cpu/mcf52x2/speed.c index b485e1ccc..70abed25c 100644 --- a/arch/m68k/cpu/mcf52x2/speed.c +++ b/arch/m68k/cpu/mcf52x2/speed.c @@ -2,7 +2,7 @@   * (C) Copyright 2003   * Josef Baumgartner <josef.baumgartner@telex.de>   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * Hayden Fraser (Hayden.Fraser@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -27,6 +27,7 @@  #include <common.h>  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR; @@ -34,10 +35,10 @@ DECLARE_GLOBAL_DATA_PTR;  int get_clocks (void)  {  #if defined(CONFIG_M5208) -	volatile pll_t *pll = (pll_t *) MMAP_PLL; +	pll_t *pll = (pll_t *) MMAP_PLL; -	pll->odr = CONFIG_SYS_PLL_ODR; -	pll->fdr = CONFIG_SYS_PLL_FDR; +	out_8(&pll->odr, CONFIG_SYS_PLL_ODR); +	out_8(&pll->fdr, CONFIG_SYS_PLL_FDR);  #endif  #if defined(CONFIG_M5249) || defined(CONFIG_M5253) @@ -70,14 +71,14 @@ int get_clocks (void)  #endif				/* CONFIG_M5249 || CONFIG_M5253 */  #if defined(CONFIG_M5275) -	volatile pll_t *pll = (volatile pll_t *)(MMAP_PLL); +	pll_t *pll = (pll_t *)(MMAP_PLL);  	/* Setup PLL */ -	pll->syncr = 0x01080000; -	while (!(pll->synsr & FMPLL_SYNSR_LOCK)) +	out_be32(&pll->syncr, 0x01080000); +	while (!(in_be32(&pll->synsr) & FMPLL_SYNSR_LOCK))  		; -	pll->syncr = 0x01000000; -	while (!(pll->synsr & FMPLL_SYNSR_LOCK)) +	out_be32(&pll->syncr, 0x01000000); +	while (!(in_be32(&pll->synsr) & FMPLL_SYNSR_LOCK))  		;  #endif diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c index 3346784c8..4f160a664 100644 --- a/arch/m68k/cpu/mcf532x/cpu.c +++ b/arch/m68k/cpu/mcf532x/cpu.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2008 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -31,15 +31,16 @@  #include <netdev.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM); +	rcm_t *rcm = (rcm_t *) (MMAP_RCM);  	udelay(1000); -	rcm->rcr |= RCM_RCR_SOFTRST; +	setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; @@ -47,14 +48,14 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int checkcpu(void)  { -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM;  	u16 msk;  	u16 id = 0;  	u8 ver;  	puts("CPU:   "); -	msk = (ccm->cir >> 6); -	ver = (ccm->cir & 0x003f); +	msk = (in_be16(&ccm->cir) >> 6); +	ver = (in_be16(&ccm->cir) & 0x003f);  	switch (msk) {  #ifdef CONFIG_MCF5301x  	case 0x78: @@ -115,18 +116,20 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void watchdog_reset(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG); -	wdp->sr = 0x5555;	/* Count register */ -	wdp->sr = 0xAAAA;	/* Count register */ +	/* Count register */ +	out_be16(&wdp->sr, 0x5555); +	out_be16(&wdp->sr, 0xaaaa);  }  int watchdog_disable(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);  	/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ -	wdp->cr |= WTM_WCR_HALTED;	/* halted watchdog timer */ +	/* halted watchdog timer */ +	setbits_be16(&wdp->cr, WTM_WCR_HALTED);  	puts("WATCHDOG:disabled\n");  	return (0); @@ -134,18 +137,18 @@ int watchdog_disable(void)  int watchdog_init(void)  { -	volatile wdog_t *wdp = (wdog_t *) (MMAP_WDOG); +	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);  	u32 wdog_module = 0;  	/* set timeout and enable watchdog */  	wdog_module = ((CONFIG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT);  #ifdef CONFIG_M5329 -	wdp->mr = (wdog_module / 8192); +	out_be16(&wdp->mr, wdog_module / 8192);  #else -	wdp->mr = (wdog_module / 4096); +	out_be16(&wdp->mr, wdog_module / 4096);  #endif -	wdp->cr = WTM_WCR_EN; +	out_be16(&wdp->cr, WTM_WCR_EN);  	puts("WATCHDOG:enabled\n");  	return (0); diff --git a/arch/m68k/cpu/mcf532x/cpu_init.c b/arch/m68k/cpu/mcf532x/cpu_init.c index 6f551b60c..f571fadc3 100644 --- a/arch/m68k/cpu/mcf532x/cpu_init.c +++ b/arch/m68k/cpu/mcf532x/cpu_init.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * (C) Copyright 2004-2008 Freescale Semiconductor, Inc. + * (C) Copyright 2004-2008, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,6 +28,7 @@  #include <common.h>  #include <watchdog.h>  #include <asm/immap.h> +#include <asm/io.h>  #if defined(CONFIG_CMD_NET)  #include <config.h> @@ -38,72 +39,68 @@  #ifdef CONFIG_MCF5301x  void cpu_init_f(void)  { -	volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	scm1_t *scm1 = (scm1_t *) MMAP_SCM1; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	/* watchdog is enabled by default - disable the watchdog */ -#ifndef CONFIG_WATCHDOG -	/*wdog->cr = 0; */ -#endif - -	scm1->mpr = 0x77777777; -	scm1->pacra = 0; -	scm1->pacrb = 0; -	scm1->pacrc = 0; -	scm1->pacrd = 0; -	scm1->pacre = 0; -	scm1->pacrf = 0; -	scm1->pacrg = 0; +	out_be32(&scm1->mpr, 0x77777777); +	out_be32(&scm1->pacra, 0); +	out_be32(&scm1->pacrb, 0); +	out_be32(&scm1->pacrc, 0); +	out_be32(&scm1->pacrd, 0); +	out_be32(&scm1->pacre, 0); +	out_be32(&scm1->pacrf, 0); +	out_be32(&scm1->pacrg, 0);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \       && defined(CONFIG_SYS_CS0_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS0_CS0; -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS0_CS0); +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \       && defined(CONFIG_SYS_CS1_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS1_CS1; -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS1_CS1); +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \       && defined(CONFIG_SYS_CS2_CTRL)) -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \       && defined(CONFIG_SYS_CS3_CTRL)) -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \       && defined(CONFIG_SYS_CS4_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS4; -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS4); +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \       && defined(CONFIG_SYS_CS5_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS5; -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS5); +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #ifdef CONFIG_FSL_I2C -	gpio->par_feci2c = GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL; +	out_8(&gpio->par_feci2c, +		GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL);  #endif  	icache_enable(); @@ -113,21 +110,21 @@ void cpu_init_f(void)  int cpu_init_r(void)  {  #ifdef CONFIG_MCFFEC -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM;  #endif  #ifdef CONFIG_MCFRTC -	volatile rtc_t *rtc = (rtc_t *) (CONFIG_SYS_MCFRTC_BASE); -	volatile rtcex_t *rtcex = (rtcex_t *) & rtc->extended; +	rtc_t *rtc = (rtc_t *) (CONFIG_SYS_MCFRTC_BASE); +	rtcex_t *rtcex = (rtcex_t *) &rtc->extended; -	rtcex->gocu = CONFIG_SYS_RTC_CNT; -	rtcex->gocl = CONFIG_SYS_RTC_SETUP; +	out_be32(&rtcex->gocu, CONFIG_SYS_RTC_CNT); +	out_be32(&rtcex->gocl, CONFIG_SYS_RTC_SETUP);  #endif  #ifdef CONFIG_MCFFEC  	if (CONFIG_SYS_FEC0_MIIBASE != CONFIG_SYS_FEC1_MIIBASE) -		ccm->misccr |= CCM_MISCCR_FECM; +		setbits_be16(&ccm->misccr, CCM_MISCCR_FECM);  	else -		ccm->misccr &= ~CCM_MISCCR_FECM; +		clrbits_be16(&ccm->misccr, CCM_MISCCR_FECM);  #endif  	return (0); @@ -135,41 +132,52 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= ~(GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD); -		gpio->par_uart |= (GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD); +		clrbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD); +		setbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);  		break;  	case 1:  #ifdef CONFIG_SYS_UART1_ALT1_GPIO -		gpio->par_simp1h &= -		    ~(GPIO_PAR_SIMP1H_DATA1_UNMASK | -		      GPIO_PAR_SIMP1H_VEN1_UNMASK); -		gpio->par_simp1h |= -		    (GPIO_PAR_SIMP1H_DATA1_U1TXD | GPIO_PAR_SIMP1H_VEN1_U1RXD); +		clrbits_8(&gpio->par_simp1h, +			GPIO_PAR_SIMP1H_DATA1_UNMASK | +			GPIO_PAR_SIMP1H_VEN1_UNMASK); +		setbits_8(&gpio->par_simp1h, +			GPIO_PAR_SIMP1H_DATA1_U1TXD | +			GPIO_PAR_SIMP1H_VEN1_U1RXD);  #elif defined(CONFIG_SYS_UART1_ALT2_GPIO) -		gpio->par_ssih &= -		    ~(GPIO_PAR_SSIH_RXD_UNMASK | GPIO_PAR_SSIH_TXD_UNMASK); -		gpio->par_ssih |= -		    (GPIO_PAR_SSIH_RXD_U1RXD | GPIO_PAR_SSIH_TXD_U1TXD); +		clrbits_8(&gpio->par_ssih, +			GPIO_PAR_SSIH_RXD_UNMASK | +			GPIO_PAR_SSIH_TXD_UNMASK); +		setbits_8(&gpio->par_ssih, +			GPIO_PAR_SSIH_RXD_U1RXD | +			GPIO_PAR_SSIH_TXD_U1TXD);  #endif  		break;  	case 2:  #ifdef CONFIG_SYS_UART2_PRI_GPIO -		gpio->par_uart |= (GPIO_PAR_UART_U2TXD | GPIO_PAR_UART_U2RXD); +		setbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U2TXD | +			GPIO_PAR_UART_U2RXD);  #elif defined(CONFIG_SYS_UART2_ALT1_GPIO) -		gpio->par_dspih &= -		    ~(GPIO_PAR_DSPIH_SIN_UNMASK | GPIO_PAR_DSPIH_SOUT_UNMASK); -		gpio->par_dspih |= -		    (GPIO_PAR_DSPIH_SIN_U2RXD | GPIO_PAR_DSPIH_SOUT_U2TXD); +		clrbits_8(&gpio->par_dspih, +			GPIO_PAR_DSPIH_SIN_UNMASK | +			GPIO_PAR_DSPIH_SOUT_UNMASK); +		setbits_8(&gpio->par_dspih, +			GPIO_PAR_DSPIH_SIN_U2RXD | +			GPIO_PAR_DSPIH_SOUT_U2TXD);  #elif defined(CONFIG_SYS_UART2_ALT2_GPIO) -		gpio->par_feci2c &= -		    ~(GPIO_PAR_FECI2C_SDA_UNMASK | GPIO_PAR_FECI2C_SCL_UNMASK); -		gpio->par_feci2c |= -		    (GPIO_PAR_FECI2C_SDA_U2TXD | GPIO_PAR_FECI2C_SCL_U2RXD); +		clrbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_SDA_UNMASK | +			GPIO_PAR_FECI2C_SCL_UNMASK); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_SDA_U2TXD | +			GPIO_PAR_FECI2C_SCL_U2RXD);  #endif  		break;  	} @@ -178,30 +186,30 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	struct fec_info_s *info = (struct fec_info_s *)dev->priv;  	if (setclear) {  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) { -			gpio->par_fec |= -			    GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC; -			gpio->par_feci2c |= -			    GPIO_PAR_FECI2C_MDC0 | GPIO_PAR_FECI2C_MDIO0; +			setbits_8(&gpio->par_fec, +				GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC); +			setbits_8(&gpio->par_feci2c, +				GPIO_PAR_FECI2C_MDC0 | GPIO_PAR_FECI2C_MDIO0);  		} else { -			gpio->par_fec |= -			    GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC; -			gpio->par_feci2c |= -			    GPIO_PAR_FECI2C_MDC1 | GPIO_PAR_FECI2C_MDIO1; +			setbits_8(&gpio->par_fec, +				GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC); +			setbits_8(&gpio->par_feci2c, +				GPIO_PAR_FECI2C_MDC1 | GPIO_PAR_FECI2C_MDIO1);  		}  	} else {  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) { -			gpio->par_fec &= -			    ~(GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC); -			gpio->par_feci2c &= GPIO_PAR_FECI2C_RMII0_UNMASK; +			clrbits_8(&gpio->par_fec, +				GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC); +			clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII0_UNMASK);  		} else { -			gpio->par_fec &= -			    ~(GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC); -			gpio->par_feci2c &= GPIO_PAR_FECI2C_RMII1_UNMASK; +			clrbits_8(&gpio->par_fec, +				GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC); +			clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII1_UNMASK);  		}  	}  	return 0; @@ -212,80 +220,81 @@ int fecpin_setclear(struct eth_device *dev, int setclear)  #ifdef CONFIG_MCF532x  void cpu_init_f(void)  { -	volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1; -	volatile scm2_t *scm2 = (scm2_t *) MMAP_SCM2; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	volatile wdog_t *wdog = (wdog_t *) MMAP_WDOG; +	scm1_t *scm1 = (scm1_t *) MMAP_SCM1; +	scm2_t *scm2 = (scm2_t *) MMAP_SCM2; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	wdog_t *wdog = (wdog_t *) MMAP_WDOG;  	/* watchdog is enabled by default - disable the watchdog */  #ifndef CONFIG_WATCHDOG -	wdog->cr = 0; +	out_be16(&wdog->cr, 0);  #endif -	scm1->mpr0 = 0x77777777; -	scm2->pacra = 0; -	scm2->pacrb = 0; -	scm2->pacrc = 0; -	scm2->pacrd = 0; -	scm2->pacre = 0; -	scm2->pacrf = 0; -	scm2->pacrg = 0; -	scm1->pacrh = 0; +	out_be32(&scm1->mpr0, 0x77777777); +	out_be32(&scm2->pacra, 0); +	out_be32(&scm2->pacrb, 0); +	out_be32(&scm2->pacrc, 0); +	out_be32(&scm2->pacrd, 0); +	out_be32(&scm2->pacre, 0); +	out_be32(&scm2->pacrf, 0); +	out_be32(&scm2->pacrg, 0); +	out_be32(&scm1->pacrh, 0);  	/* Port configuration */ -	gpio->par_cs = 0; +	out_8(&gpio->par_cs, 0);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \       && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \       && defined(CONFIG_SYS_CS1_CTRL))  	/* Latch chipselect */ -	gpio->par_cs |= GPIO_PAR_CS1; -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS1); +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \       && defined(CONFIG_SYS_CS2_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS2; -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS2); +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \       && defined(CONFIG_SYS_CS3_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS3; -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS3); +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \       && defined(CONFIG_SYS_CS4_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS4; -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS4); +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \       && defined(CONFIG_SYS_CS5_CTRL)) -	gpio->par_cs |= GPIO_PAR_CS5; -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	setbits_8(&gpio->par_cs, GPIO_PAR_CS5); +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #ifdef CONFIG_FSL_I2C -	gpio->par_feci2c = GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA; +	out_8(&gpio->par_feci2c, +		GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA);  #endif  	icache_enable(); @@ -301,30 +310,35 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= ~(GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0); -		gpio->par_uart |= (GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0); +		clrbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);  		break;  	case 1: -		gpio->par_uart &= -		    ~(GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3)); -		gpio->par_uart |= -		    (GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3)); +		clrbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3)); +		setbits_be16(&gpio->par_uart, +			GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));  		break;  	case 2:  #ifdef CONFIG_SYS_UART2_ALT1_GPIO -		gpio->par_timer &= 0x0F; -		gpio->par_timer |= (GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2); +		clrbits_8(&gpio->par_timer, 0xf0); +		setbits_8(&gpio->par_timer, +			GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);  #elif defined(CONFIG_SYS_UART2_ALT2_GPIO) -		gpio->par_feci2c &= 0xFF00; -		gpio->par_feci2c |= (GPIO_PAR_FECI2C_SCL_UTXD2 | GPIO_PAR_FECI2C_SDA_URXD2); +		clrbits_8(&gpio->par_feci2c, 0x00ff); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_SCL_UTXD2 | GPIO_PAR_FECI2C_SDA_URXD2);  #elif defined(CONFIG_SYS_UART2_ALT3_GPIO) -		gpio->par_ssi &= 0xF0FF; -		gpio->par_ssi |= (GPIO_PAR_SSI_RXD(2) | GPIO_PAR_SSI_TXD(2)); +		clrbits_be16(&gpio->par_ssi, 0x0f00); +		setbits_be16(&gpio->par_ssi, +			GPIO_PAR_SSI_RXD(2) | GPIO_PAR_SSI_TXD(2));  #endif  		break;  	} @@ -333,16 +347,18 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	if (setclear) { -		gpio->par_fec |= GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC; -		gpio->par_feci2c |= -		    GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO; +		setbits_8(&gpio->par_fec, +			GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC); +		setbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);  	} else { -		gpio->par_fec &= ~(GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC); -		gpio->par_feci2c &= -		    ~(GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO); +		clrbits_8(&gpio->par_fec, +			GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC); +		clrbits_8(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);  	}  	return 0;  } diff --git a/arch/m68k/cpu/mcf532x/interrupts.c b/arch/m68k/cpu/mcf532x/interrupts.c index d6c820545..d1ea2ff5a 100644 --- a/arch/m68k/cpu/mcf532x/interrupts.c +++ b/arch/m68k/cpu/mcf532x/interrupts.c @@ -1,6 +1,6 @@  /*   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -25,14 +25,15 @@  /* CPU specific interrupt routine */  #include <common.h>  #include <asm/immap.h> +#include <asm/io.h>  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */ -	intp->imrh0 |= 0xFFFFFFFF; -	intp->imrl0 |= 0xFFFFFFFF; +	setbits_be32(&intp->imrh0, 0xffffffff); +	setbits_be32(&intp->imrl0, 0xffffffff);  	enable_interrupts();  	return 0; @@ -41,9 +42,9 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrh0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrh0, CONFIG_SYS_TMRINTR_MASK);  }  #endif diff --git a/arch/m68k/cpu/mcf532x/speed.c b/arch/m68k/cpu/mcf532x/speed.c index 5a29e2567..cfdcc8b80 100644 --- a/arch/m68k/cpu/mcf532x/speed.c +++ b/arch/m68k/cpu/mcf532x/speed.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2008 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -29,6 +29,7 @@  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR; @@ -65,13 +66,13 @@ DECLARE_GLOBAL_DATA_PTR;  /* Get the value of the current system clock */  int get_sys_clock(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)(MMAP_CCM); -	volatile pll_t *pll = (volatile pll_t *)(MMAP_PLL); +	ccm_t *ccm = (ccm_t *)(MMAP_CCM); +	pll_t *pll = (pll_t *)(MMAP_PLL);  	int divider;  	/* Test to see if device is in LIMP mode */ -	if (ccm->misccr & CCM_MISCCR_LIMP) { -		divider = ccm->cdr & CCM_CDR_LPDIV(0xF); +	if (in_be16(&ccm->misccr) & CCM_MISCCR_LIMP) { +		divider = in_be16(&ccm->cdr) & CCM_CDR_LPDIV(0xF);  #ifdef CONFIG_MCF5301x  		return (FREF / (3 * (1 << divider)));  #endif @@ -80,14 +81,14 @@ int get_sys_clock(void)  #endif  	} else {  #ifdef CONFIG_MCF5301x -		u32 pfdr = (pll->pcr & 0x3F) + 1; -		u32 refdiv = (1 << ((pll->pcr & PLL_PCR_REFDIV(7)) >> 8)); -		u32 busdiv = ((pll->pdr & 0x00F0) >> 4) + 1; +		u32 pfdr = (in_be32(&pll->pcr) & 0x3F) + 1; +		u32 refdiv = (1 << ((in_be32(&pll->pcr) & PLL_PCR_REFDIV(7)) >> 8)); +		u32 busdiv = ((in_be32(&pll->pdr) & 0x00F0) >> 4) + 1;  		return (((FREF * pfdr) / refdiv) / busdiv);  #endif  #ifdef CONFIG_MCF532x -		return ((FREF * pll->pfdr) / (BUSDIV * 4)); +		return (FREF * in_8(&pll->pfdr)) / (BUSDIV * 4);  #endif  	}  } @@ -103,7 +104,7 @@ int get_sys_clock(void)   */  int clock_limp(int div)  { -	volatile ccm_t *ccm = (volatile ccm_t *)(MMAP_CCM); +	ccm_t *ccm = (ccm_t *)(MMAP_CCM);  	u32 temp;  	/* Check bounds of divider */ @@ -113,12 +114,12 @@ int clock_limp(int div)  		div = MAX_LPD;  	/* Save of the current value of the SSIDIV so we don't overwrite the value */ -	temp = (ccm->cdr & CCM_CDR_SSIDIV(0xFF)); +	temp = (in_be16(&ccm->cdr) & CCM_CDR_SSIDIV(0xFF));  	/* Apply the divider to the system clock */ -	ccm->cdr = (CCM_CDR_LPDIV(div) | CCM_CDR_SSIDIV(temp)); +	out_be16(&ccm->cdr, CCM_CDR_LPDIV(div) | CCM_CDR_SSIDIV(temp)); -	ccm->misccr |= CCM_MISCCR_LIMP; +	setbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  	return (FREF / (3 * (1 << div)));  } @@ -126,14 +127,15 @@ int clock_limp(int div)  /* Exit low power LIMP mode */  int clock_exit_limp(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)(MMAP_CCM); +	ccm_t *ccm = (ccm_t *)(MMAP_CCM);  	int fout;  	/* Exit LIMP mode */ -	ccm->misccr &= (~CCM_MISCCR_LIMP); +	clrbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  	/* Wait for PLL to lock */ -	while (!(ccm->misccr & CCM_MISCCR_PLL_LOCK)) ; +	while (!(in_be16(&ccm->misccr) & CCM_MISCCR_PLL_LOCK)) +		;  	fout = get_sys_clock(); @@ -153,10 +155,10 @@ int clock_exit_limp(void)  int clock_pll(int fsys, int flags)  {  #ifdef CONFIG_MCF532x -	volatile u32 *sdram_workaround = (volatile u32 *)(MMAP_SDRAM + 0x80); +	u32 *sdram_workaround = (u32 *)(MMAP_SDRAM + 0x80);  #endif -	volatile sdram_t *sdram = (volatile sdram_t *)(MMAP_SDRAM); -	volatile pll_t *pll = (volatile pll_t *)(MMAP_PLL); +	sdram_t *sdram = (sdram_t *)(MMAP_SDRAM); +	pll_t *pll = (pll_t *)(MMAP_PLL);  	int fref, temp, fout, mfd;  	u32 i; @@ -165,13 +167,13 @@ int clock_pll(int fsys, int flags)  	if (fsys == 0) {  		/* Return current PLL output */  #ifdef CONFIG_MCF5301x -		u32 busdiv = ((pll->pdr >> 4) & 0x0F) + 1; -		mfd = (pll->pcr & 0x3F) + 1; +		u32 busdiv = ((in_be32(&pll->pdr) >> 4) & 0x0F) + 1; +		mfd = (in_be32(&pll->pcr) & 0x3F) + 1;  		return (fref * mfd) / busdiv;  #endif  #ifdef CONFIG_MCF532x -		mfd = pll->pfdr; +		mfd = in_8(&pll->pfdr);  		return (fref * mfd / (BUSDIV * 4));  #endif @@ -211,8 +213,8 @@ int clock_pll(int fsys, int flags)  	 * If it has then the SDRAM needs to be put into self refresh  	 * mode before reprogramming the PLL.  	 */ -	if (sdram->ctrl & SDRAMC_SDCR_REF) -		sdram->ctrl &= ~SDRAMC_SDCR_CKE; +	if (in_be32(&sdram->ctrl) & SDRAMC_SDCR_REF) +		clrbits_be32(&sdram->ctrl, SDRAMC_SDCR_CKE);  	/*  	 * Initialize the PLL to generate the new system clock frequency. @@ -223,35 +225,36 @@ int clock_pll(int fsys, int flags)  	clock_limp(DEFAULT_LPD);  #ifdef CONFIG_MCF5301x -	pll->pdr = -	    PLL_PDR_OUTDIV1((BUSDIV / 3) - 1)	| -	    PLL_PDR_OUTDIV2(BUSDIV - 1)	| -	    PLL_PDR_OUTDIV3((BUSDIV / 2) - 1)	| -	    PLL_PDR_OUTDIV4(USBDIV - 1); +	out_be32(&pll->pdr, +		PLL_PDR_OUTDIV1((BUSDIV / 3) - 1) | +		PLL_PDR_OUTDIV2(BUSDIV - 1)	| +		PLL_PDR_OUTDIV3((BUSDIV / 2) - 1) | +		PLL_PDR_OUTDIV4(USBDIV - 1)); -	pll->pcr &= PLL_PCR_FBDIV_UNMASK; -	pll->pcr |= PLL_PCR_FBDIV(mfd - 1); +	clrbits_be32(&pll->pcr, ~PLL_PCR_FBDIV_UNMASK); +	setbits_be32(&pll->pcr, PLL_PCR_FBDIV(mfd - 1));  #endif  #ifdef CONFIG_MCF532x  	/* Reprogram PLL for desired fsys */ -	pll->podr = (PLL_PODR_CPUDIV(BUSDIV / 3) | PLL_PODR_BUSDIV(BUSDIV)); +	out_8(&pll->podr, +		PLL_PODR_CPUDIV(BUSDIV / 3) | PLL_PODR_BUSDIV(BUSDIV)); -	pll->pfdr = mfd; +	out_8(&pll->pfdr, mfd);  #endif  	/* Exit LIMP mode */  	clock_exit_limp();  	/* Return the SDRAM to normal operation if it is in use. */ -	if (sdram->ctrl & SDRAMC_SDCR_REF) -		sdram->ctrl |= SDRAMC_SDCR_CKE; +	if (in_be32(&sdram->ctrl) & SDRAMC_SDCR_REF) +		setbits_be32(&sdram->ctrl, SDRAMC_SDCR_CKE);  #ifdef CONFIG_MCF532x  	/*  	 * software workaround for SDRAM opeartion after exiting LIMP  	 * mode errata  	 */ -	*sdram_workaround = CONFIG_SYS_SDRAM_BASE; +	out_be32(sdram_workaround, CONFIG_SYS_SDRAM_BASE);  #endif  	/* wait for DQS logic to relock */ diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c index 323a54eab..adfc708c3 100644 --- a/arch/m68k/cpu/mcf5445x/cpu.c +++ b/arch/m68k/cpu/mcf5445x/cpu.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -31,14 +31,15 @@  #include <netdev.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile rcm_t *rcm = (rcm_t *) (MMAP_RCM); +	rcm_t *rcm = (rcm_t *) (MMAP_RCM);  	udelay(1000); -	rcm->rcr |= RCM_RCR_SOFTRST; +	setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);  	/* we don't return! */  	return 0; @@ -46,14 +47,14 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int checkcpu(void)  { -	volatile ccm_t *ccm = (ccm_t *) MMAP_CCM; +	ccm_t *ccm = (ccm_t *) MMAP_CCM;  	u16 msk;  	u16 id = 0;  	u8 ver;  	puts("CPU:   "); -	msk = (ccm->cir >> 6); -	ver = (ccm->cir & 0x003f); +	msk = (in_be16(&ccm->cir) >> 6); +	ver = (in_be16(&ccm->cir) & 0x003f);  	switch (msk) {  	case 0x48:  		id = 54455; diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c b/arch/m68k/cpu/mcf5445x/cpu_init.c index fdcd18585..3f9209ff1 100644 --- a/arch/m68k/cpu/mcf5445x/cpu_init.c +++ b/arch/m68k/cpu/mcf5445x/cpu_init.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * (C) Copyright 2004-2007 Freescale Semiconductor, Inc. + * (C) Copyright 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -30,6 +30,7 @@  #include <asm/immap.h>  #include <asm/processor.h>  #include <asm/rtc.h> +#include <asm/io.h>  #if defined(CONFIG_CMD_NET)  #include <config.h> @@ -46,64 +47,64 @@   */  void cpu_init_f(void)  { -	volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	scm1_t *scm1 = (scm1_t *) MMAP_SCM1; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	scm1->mpr = 0x77777777; -	scm1->pacra = 0; -	scm1->pacrb = 0; -	scm1->pacrc = 0; -	scm1->pacrd = 0; -	scm1->pacre = 0; -	scm1->pacrf = 0; -	scm1->pacrg = 0; +	out_be32(&scm1->mpr, 0x77777777); +	out_be32(&scm1->pacra, 0); +	out_be32(&scm1->pacrb, 0); +	out_be32(&scm1->pacrc, 0); +	out_be32(&scm1->pacrd, 0); +	out_be32(&scm1->pacre, 0); +	out_be32(&scm1->pacrf, 0); +	out_be32(&scm1->pacrg, 0);  	/* FlexBus */ -	gpio->par_be = -	    GPIO_PAR_BE_BE3_BE3 | GPIO_PAR_BE_BE2_BE2 | GPIO_PAR_BE_BE1_BE1 | -	    GPIO_PAR_BE_BE0_BE0; -	gpio->par_fbctl = -	    GPIO_PAR_FBCTL_OE | GPIO_PAR_FBCTL_TA_TA | GPIO_PAR_FBCTL_RW_RW | -	    GPIO_PAR_FBCTL_TS_TS; +	out_8(&gpio->par_be, +		GPIO_PAR_BE_BE3_BE3 | GPIO_PAR_BE_BE2_BE2 | +		GPIO_PAR_BE_BE1_BE1 | GPIO_PAR_BE_BE0_BE0); +	out_8(&gpio->par_fbctl, +		GPIO_PAR_FBCTL_OE | GPIO_PAR_FBCTL_TA_TA | +		GPIO_PAR_FBCTL_RW_RW | GPIO_PAR_FBCTL_TS_TS);  #if !defined(CONFIG_CF_SBF)  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) && defined(CONFIG_SYS_CS1_CTRL))  	/* Latch chipselect */ -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) && defined(CONFIG_SYS_CS2_CTRL)) -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) && defined(CONFIG_SYS_CS3_CTRL)) -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) && defined(CONFIG_SYS_CS4_CTRL)) -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) && defined(CONFIG_SYS_CS5_CTRL)) -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  	/* @@ -115,7 +116,8 @@ void cpu_init_f(void)  		setvbr(CONFIG_SYS_CS0_BASE);  #ifdef CONFIG_FSL_I2C -	gpio->par_feci2c = GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA; +	out_be16(&gpio->par_feci2c, +		GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA);  #endif  	icache_enable(); @@ -127,11 +129,11 @@ void cpu_init_f(void)  int cpu_init_r(void)  {  #ifdef CONFIG_MCFRTC -	volatile rtc_t *rtc = (volatile rtc_t *)(CONFIG_SYS_MCFRTC_BASE); -	volatile rtcex_t *rtcex = (volatile rtcex_t *)&rtc->extended; +	rtc_t *rtc = (rtc_t *)(CONFIG_SYS_MCFRTC_BASE); +	rtcex_t *rtcex = (rtcex_t *)&rtc->extended; -	rtcex->gocu = (CONFIG_SYS_RTC_OSCILLATOR >> 16) & 0xFFFF; -	rtcex->gocl = CONFIG_SYS_RTC_OSCILLATOR & 0xFFFF; +	out_be32(&rtcex->gocu, (CONFIG_SYS_RTC_OSCILLATOR >> 16) & 0xffff); +	out_be32(&rtcex->gocl, CONFIG_SYS_RTC_OSCILLATOR & 0xffff);  #endif  	return (0); @@ -139,40 +141,40 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_uart &= -		    ~(GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD); -		gpio->par_uart |= -		    (GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD); +		clrbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD); +		setbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD);  		break;  	case 1:  #ifdef CONFIG_SYS_UART1_PRI_GPIO -		gpio->par_uart &= -		    ~(GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD); -		gpio->par_uart |= -		    (GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD); +		clrbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD); +		setbits_8(&gpio->par_uart, +			GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD);  #elif defined(CONFIG_SYS_UART1_ALT1_GPIO) -		gpio->par_ssi &= -		    (GPIO_PAR_SSI_SRXD_UNMASK | GPIO_PAR_SSI_STXD_UNMASK); -		gpio->par_ssi |= -		    (GPIO_PAR_SSI_SRXD_U1RXD | GPIO_PAR_SSI_STXD_U1TXD); +		clrbits_be16(&gpio->par_ssi, +			~(GPIO_PAR_SSI_SRXD_UNMASK | GPIO_PAR_SSI_STXD_UNMASK)); +		setbits_be16(&gpio->par_ssi, +			GPIO_PAR_SSI_SRXD_U1RXD | GPIO_PAR_SSI_STXD_U1TXD);  #endif  		break;  	case 2:  #if defined(CONFIG_SYS_UART2_ALT1_GPIO) -		gpio->par_timer &= -		    (GPIO_PAR_TIMER_T3IN_UNMASK | GPIO_PAR_TIMER_T2IN_UNMASK); -		gpio->par_timer |= -		    (GPIO_PAR_TIMER_T3IN_U2RXD | GPIO_PAR_TIMER_T2IN_U2TXD); +		clrbits_8(&gpio->par_timer, +			~(GPIO_PAR_TIMER_T3IN_UNMASK | GPIO_PAR_TIMER_T2IN_UNMASK)); +		setbits_8(&gpio->par_timer, +			GPIO_PAR_TIMER_T3IN_U2RXD | GPIO_PAR_TIMER_T2IN_U2TXD);  #elif defined(CONFIG_SYS_UART2_ALT2_GPIO) -		gpio->par_timer &= -		    (GPIO_PAR_FECI2C_SCL_UNMASK | GPIO_PAR_FECI2C_SDA_UNMASK); -		gpio->par_timer |= -		    (GPIO_PAR_FECI2C_SCL_U2TXD | GPIO_PAR_FECI2C_SDA_U2RXD); +		clrbits_8(&gpio->par_timer, +			~(GPIO_PAR_FECI2C_SCL_UNMASK | GPIO_PAR_FECI2C_SDA_UNMASK)); +		setbits_8(&gpio->par_timer, +			GPIO_PAR_FECI2C_SCL_U2TXD | GPIO_PAR_FECI2C_SDA_U2RXD);  #endif  		break;  	} @@ -181,43 +183,43 @@ void uart_port_conf(int port)  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	struct fec_info_s *info = (struct fec_info_s *)dev->priv;  	if (setclear) {  #ifdef CONFIG_SYS_FEC_NO_SHARED_PHY  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) -			gpio->par_feci2c |= -			    (GPIO_PAR_FECI2C_MDC0_MDC0 | -			     GPIO_PAR_FECI2C_MDIO0_MDIO0); +			setbits_be16(&gpio->par_feci2c, +				GPIO_PAR_FECI2C_MDC0_MDC0 | +				GPIO_PAR_FECI2C_MDIO0_MDIO0);  		else -			gpio->par_feci2c |= -			    (GPIO_PAR_FECI2C_MDC1_MDC1 | -			     GPIO_PAR_FECI2C_MDIO1_MDIO1); +			setbits_be16(&gpio->par_feci2c, +				GPIO_PAR_FECI2C_MDC1_MDC1 | +				GPIO_PAR_FECI2C_MDIO1_MDIO1);  #else -		gpio->par_feci2c |= -		    (GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0); +		setbits_be16(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);  #endif  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) -			gpio->par_fec |= GPIO_PAR_FEC_FEC0_RMII_GPIO; +			setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC0_RMII_GPIO);  		else -			gpio->par_fec |= GPIO_PAR_FEC_FEC1_RMII_ATA; +			setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC1_RMII_ATA);  	} else { -		gpio->par_feci2c &= -		    ~(GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0); +		clrbits_be16(&gpio->par_feci2c, +			GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {  #ifdef CONFIG_SYS_FEC_FULL_MII -			gpio->par_fec |= GPIO_PAR_FEC_FEC0_MII; +			setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC0_MII);  #else -			gpio->par_fec &= GPIO_PAR_FEC_FEC0_UNMASK; +			clrbits_8(&gpio->par_fec, ~GPIO_PAR_FEC_FEC0_UNMASK);  #endif  		} else {  #ifdef CONFIG_SYS_FEC_FULL_MII -			gpio->par_fec |= GPIO_PAR_FEC_FEC1_MII; +			setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC1_MII);  #else -			gpio->par_fec &= GPIO_PAR_FEC_FEC1_UNMASK; +			clrbits_8(&gpio->par_fec, ~GPIO_PAR_FEC_FEC1_UNMASK);  #endif  		}  	} @@ -228,43 +230,45 @@ int fecpin_setclear(struct eth_device *dev, int setclear)  #ifdef CONFIG_CF_DSPI  void cfspi_port_conf(void)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	gpio->par_dspi = GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT | -	    GPIO_PAR_DSPI_SCK_SCK; +	out_8(&gpio->par_dspi, +		GPIO_PAR_DSPI_SIN_SIN | +		GPIO_PAR_DSPI_SOUT_SOUT | +		GPIO_PAR_DSPI_SCK_SCK);  }  int cfspi_claim_bus(uint bus, uint cs)  { -	volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	dspi_t *dspi = (dspi_t *) MMAP_DSPI; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	if ((dspi->sr & DSPI_SR_TXRXS) != DSPI_SR_TXRXS) +	if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS)  		return -1;  	/* Clear FIFO and resume transfer */ -	dspi->mcr &= ~(DSPI_MCR_CTXF | DSPI_MCR_CRXF); +	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);  	switch (cs) {  	case 0: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS0_PCS0; -		gpio->par_dspi |= GPIO_PAR_DSPI_PCS0_PCS0; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0); +		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);  		break;  	case 1: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS1_PCS1; -		gpio->par_dspi |= GPIO_PAR_DSPI_PCS1_PCS1; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1); +		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1);  		break;  	case 2: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS2_PCS2; -		gpio->par_dspi |= GPIO_PAR_DSPI_PCS2_PCS2; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2); +		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2);  		break;  	case 3: -		gpio->par_dma &= GPIO_PAR_DMA_DACK0_UNMASK; -		gpio->par_dma |= GPIO_PAR_DMA_DACK0_PCS3; +		clrbits_8(&gpio->par_dma, ~GPIO_PAR_DMA_DACK0_UNMASK); +		setbits_8(&gpio->par_dma, GPIO_PAR_DMA_DACK0_PCS3);  		break;  	case 5: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS5_PCS5; -		gpio->par_dspi |= GPIO_PAR_DSPI_PCS5_PCS5; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5); +		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5);  		break;  	} @@ -273,26 +277,27 @@ int cfspi_claim_bus(uint bus, uint cs)  void cfspi_release_bus(uint bus, uint cs)  { -	volatile dspi_t *dspi = (dspi_t *) MMAP_DSPI; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	dspi_t *dspi = (dspi_t *) MMAP_DSPI; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	dspi->mcr &= ~(DSPI_MCR_CTXF | DSPI_MCR_CRXF);	/* Clear FIFO */ +	/* Clear FIFO */ +	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);  	switch (cs) {  	case 0: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS0_PCS0; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);  		break;  	case 1: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS1_PCS1; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1);  		break;  	case 2: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS2_PCS2; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2);  		break;  	case 3: -		gpio->par_dma &= GPIO_PAR_DMA_DACK0_UNMASK; +		clrbits_8(&gpio->par_dma, ~GPIO_PAR_DMA_DACK0_UNMASK);  		break;  	case 5: -		gpio->par_dspi &= ~GPIO_PAR_DSPI_PCS5_PCS5; +		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5);  		break;  	}  } diff --git a/arch/m68k/cpu/mcf5445x/interrupts.c b/arch/m68k/cpu/mcf5445x/interrupts.c index 85828a67b..a2cf51933 100644 --- a/arch/m68k/cpu/mcf5445x/interrupts.c +++ b/arch/m68k/cpu/mcf5445x/interrupts.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2004   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,14 +28,15 @@  /* CPU specific interrupt routine */  #include <common.h>  #include <asm/immap.h> +#include <asm/io.h>  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */ -	intp->imrh0 |= 0xFFFFFFFF; -	intp->imrl0 |= 0xFFFFFFFF; +	setbits_be32(&intp->imrh0, 0xffffffff); +	setbits_be32(&intp->imrl0, 0xffffffff);  	enable_interrupts();  	return 0; @@ -44,9 +45,9 @@ int interrupt_init(void)  #if defined(CONFIG_MCFTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrh0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrh0, CONFIG_SYS_TMRINTR_MASK);  }  #endif diff --git a/arch/m68k/cpu/mcf5445x/pci.c b/arch/m68k/cpu/mcf5445x/pci.c index 7f9784c3c..c32fcee7f 100644 --- a/arch/m68k/cpu/mcf5445x/pci.c +++ b/arch/m68k/cpu/mcf5445x/pci.c @@ -1,5 +1,5 @@  /* - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -60,78 +60,82 @@ PCI_OP(write, dword, u32, out_le32, 0)  void pci_mcf5445x_init(struct pci_controller *hose)  { -	volatile pci_t *pci = (volatile pci_t *)MMAP_PCI; -	volatile pciarb_t *pciarb = (volatile pciarb_t *)MMAP_PCIARB; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	pci_t *pci = (pci_t *)MMAP_PCI; +	pciarb_t *pciarb = (pciarb_t *)MMAP_PCIARB; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	u32 barEn = 0; -	pciarb->acr = 0x001F001F; +	out_be32(&pciarb->acr, 0x001f001f);  	/* Set PCIGNT1, PCIREQ1, PCIREQ0/PCIGNTIN, PCIGNT0/PCIREQOUT,  	   PCIREQ2, PCIGNT2 */ -	gpio->par_pci = -	    GPIO_PAR_PCI_GNT3_GNT3 | GPIO_PAR_PCI_GNT2 | GPIO_PAR_PCI_GNT1 | -	    GPIO_PAR_PCI_GNT0 | GPIO_PAR_PCI_REQ3_REQ3 | GPIO_PAR_PCI_REQ2 | -	    GPIO_PAR_PCI_REQ1 | GPIO_PAR_PCI_REQ0; +	out_be16(&gpio->par_pci, +		GPIO_PAR_PCI_GNT3_GNT3 | GPIO_PAR_PCI_GNT2 | +		GPIO_PAR_PCI_GNT1 | GPIO_PAR_PCI_GNT0 | +		GPIO_PAR_PCI_REQ3_REQ3 | GPIO_PAR_PCI_REQ2 | +		GPIO_PAR_PCI_REQ1 | GPIO_PAR_PCI_REQ0);  	/* Assert reset bit */ -	pci->gscr |= PCI_GSCR_PR; +	setbits_be32(&pci->gscr, PCI_GSCR_PR); -	pci->tcr1 |= PCI_TCR1_P; +	setbits_be32(&pci->tcr1, PCI_TCR1_P);  	/* Initiator windows */ -	pci->iw0btar = CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16); -	pci->iw1btar = CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16); -	pci->iw2btar = CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16); +	out_be32(&pci->iw0btar, +		CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16)); +	out_be32(&pci->iw1btar, +		CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16)); +	out_be32(&pci->iw2btar, +		CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16)); -	pci->iwcr = -	    PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | -	    PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO; +	out_be32(&pci->iwcr, +		PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | +		PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO); -	pci->icr = 0; +	out_be32(&pci->icr, 0);  	/* Enable bus master and mem access */ -	pci->scr = PCI_SCR_B | PCI_SCR_M; +	out_be32(&pci->scr, PCI_SCR_B | PCI_SCR_M);  	/* Cache line size and master latency */ -	pci->cr1 = PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xF8); -	pci->cr2 = 0; +	out_be32(&pci->cr1, PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xF8)); +	out_be32(&pci->cr2, 0);  #ifdef CONFIG_SYS_PCI_BAR0 -	pci->bar0 = PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0); -	pci->tbatr0 = CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN; +	out_be32(&pci->bar0, PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0)); +	out_be32(&pci->tbatr0, CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B0E;  #endif  #ifdef CONFIG_SYS_PCI_BAR1 -	pci->bar1 = PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1); -	pci->tbatr1 = CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN; +	out_be32(&pci->bar1, PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1)); +	out_be32(&pci->tbatr1, CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B1E;  #endif  #ifdef CONFIG_SYS_PCI_BAR2 -	pci->bar2 = PCI_BAR_BAR2(CONFIG_SYS_PCI_BAR2); -	pci->tbatr2 = CONFIG_SYS_PCI_TBATR2 | PCI_TBATR_EN; +	out_be32(&pci->bar2, PCI_BAR_BAR2(CONFIG_SYS_PCI_BAR2)); +	out_be32(&pci->tbatr2, CONFIG_SYS_PCI_TBATR2 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B2E;  #endif  #ifdef CONFIG_SYS_PCI_BAR3 -	pci->bar3 = PCI_BAR_BAR3(CONFIG_SYS_PCI_BAR3); -	pci->tbatr3 = CONFIG_SYS_PCI_TBATR3 | PCI_TBATR_EN; +	out_be32(&pci->bar3, PCI_BAR_BAR3(CONFIG_SYS_PCI_BAR3)); +	out_be32(&pci->tbatr3, CONFIG_SYS_PCI_TBATR3 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B3E;  #endif  #ifdef CONFIG_SYS_PCI_BAR4 -	pci->bar4 = PCI_BAR_BAR4(CONFIG_SYS_PCI_BAR4); -	pci->tbatr4 = CONFIG_SYS_PCI_TBATR4 | PCI_TBATR_EN; +	out_be32(&pci->bar4, PCI_BAR_BAR4(CONFIG_SYS_PCI_BAR4)); +	out_be32(&pci->tbatr4, CONFIG_SYS_PCI_TBATR4 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B4E;  #endif  #ifdef CONFIG_SYS_PCI_BAR5 -	pci->bar5 = PCI_BAR_BAR5(CONFIG_SYS_PCI_BAR5); -	pci->tbatr5 = CONFIG_SYS_PCI_TBATR5 | PCI_TBATR_EN; +	out_be32(&pci->bar5, PCI_BAR_BAR5(CONFIG_SYS_PCI_BAR5)); +	out_be32(&pci->tbatr5, CONFIG_SYS_PCI_TBATR5 | PCI_TBATR_EN);  	barEn |= PCI_TCR2_B5E;  #endif -	pci->tcr2 = barEn; +	out_be32(&pci->tcr2, barEn);  	/* Deassert reset bit */ -	pci->gscr &= ~PCI_GSCR_PR; +	clrbits_be32(&pci->gscr, PCI_GSCR_PR);  	udelay(1000);  	/* Enable PCI bus master support */ diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c index 9c0c07733..073b7efaf 100644 --- a/arch/m68k/cpu/mcf5445x/speed.c +++ b/arch/m68k/cpu/mcf5445x/speed.c @@ -1,6 +1,6 @@  /*   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -26,6 +26,7 @@  #include <asm/processor.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR; @@ -44,7 +45,7 @@ DECLARE_GLOBAL_DATA_PTR;  void clock_enter_limp(int lpdiv)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; +	ccm_t *ccm = (ccm_t *)MMAP_CCM;  	int i, j;  	/* Check bounds of divider */ @@ -57,10 +58,10 @@ void clock_enter_limp(int lpdiv)  	for (i = 0, j = lpdiv; j != 1; j >>= 1, i++) ;  	/* Apply the divider to the system clock */ -	ccm->cdr = (ccm->cdr & 0xF0FF) | CCM_CDR_LPDIV(i); +	clrsetbits_be16(&ccm->cdr, 0x0f00, CCM_CDR_LPDIV(i));  	/* Enable Limp Mode */ -	ccm->misccr |= CCM_MISCCR_LIMP; +	setbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  }  /* @@ -69,14 +70,15 @@ void clock_enter_limp(int lpdiv)   */  void clock_exit_limp(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; -	volatile pll_t *pll = (volatile pll_t *)MMAP_PLL; +	ccm_t *ccm = (ccm_t *)MMAP_CCM; +	pll_t *pll = (pll_t *)MMAP_PLL;  	/* Exit Limp mode */ -	ccm->misccr &= ~CCM_MISCCR_LIMP; +	clrbits_be16(&ccm->misccr, CCM_MISCCR_LIMP);  	/* Wait for the PLL to lock */ -	while (!(pll->psr & PLL_PSR_LOCK)) ; +	while (!(in_be32(&pll->psr) & PLL_PSR_LOCK)) +		;  }  /* @@ -85,8 +87,8 @@ void clock_exit_limp(void)  int get_clocks(void)  { -	volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM; -	volatile pll_t *pll = (volatile pll_t *)MMAP_PLL; +	ccm_t *ccm = (ccm_t *)MMAP_CCM; +	pll_t *pll = (pll_t *)MMAP_PLL;  	int pllmult_nopci[] = { 20, 10, 24, 18, 12, 6, 16, 8 };  	int pllmult_pci[] = { 12, 6, 16, 8 };  	int vco = 0, bPci, temp, fbtemp, pcrvalue; @@ -94,13 +96,13 @@ int get_clocks(void)  	u16 fbpll_mask;  #ifdef CONFIG_M54455EVB -	volatile u8 *cpld = (volatile u8 *)(CONFIG_SYS_CS2_BASE + 3); +	u8 *cpld = (u8 *)(CONFIG_SYS_CS2_BASE + 3);  #endif  	u8 bootmode;  	/* To determine PCI is present or not */ -	if (((ccm->ccr & CCM_CCR_360_FBCONFIG_MASK) == 0x00e0) || -	    ((ccm->ccr & CCM_CCR_360_FBCONFIG_MASK) == 0x0060)) { +	if (((in_be16(&ccm->ccr) & CCM_CCR_360_FBCONFIG_MASK) == 0x00e0) || +	    ((in_be16(&ccm->ccr) & CCM_CCR_360_FBCONFIG_MASK) == 0x0060)) {  		pPllmult = &pllmult_pci[0];  		fbpll_mask = 3;		/* 11b */  		bPci = 1; @@ -114,7 +116,7 @@ int get_clocks(void)  	}  #ifdef CONFIG_M54455EVB -	bootmode = (*cpld & 0x03); +	bootmode = (in_8(cpld) & 0x03);  	if (bootmode != 3) {  		/* Temporary read from CCR- fixed fb issue, must be the same clock @@ -122,11 +124,11 @@ int get_clocks(void)  		fbtemp = pPllmult[ccm->ccr & fbpll_mask];  		/* Break down into small pieces, code still in flex bus */ -		pcrvalue = pll->pcr & 0xFFFFF0FF; +		pcrvalue = in_be32(&pll->pcr) & 0xFFFFF0FF;  		temp = fbtemp - 1;  		pcrvalue |= PLL_PCR_OUTDIV3(temp); -		pll->pcr = pcrvalue; +		out_be32(&pll->pcr, pcrvalue);  	}  #endif  #ifdef CONFIG_M54451EVB @@ -137,9 +139,10 @@ int get_clocks(void)  	bootmode = 2;  	/* default value is 16 mul, set to 20 mul */ -	pcrvalue = (pll->pcr & 0x00FFFFFF) | 0x14000000; -	pll->pcr = pcrvalue; -	while ((pll->psr & PLL_PSR_LOCK) != PLL_PSR_LOCK); +	pcrvalue = (in_be32(&pll->pcr) & 0x00FFFFFF) | 0x14000000; +	out_be32(&pll->pcr, pcrvalue); +	while ((in_be32(&pll->psr) & PLL_PSR_LOCK) != PLL_PSR_LOCK) +		;  #endif  #endif @@ -149,10 +152,10 @@ int get_clocks(void)  		if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) {  			/* invaild range, re-set in PCR */ -			int temp = ((pll->pcr & PLL_PCR_OUTDIV2_MASK) >> 4) + 1; +			int temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1;  			int i, j, bus; -			j = (pll->pcr & 0xFF000000) >> 24; +			j = (in_be32(&pll->pcr) & 0xFF000000) >> 24;  			for (i = j; i < 0xFF; i++) {  				vco = i * CONFIG_SYS_INPUT_CLKSRC;  				if (vco >= CLOCK_PLL_FVCO_MIN) { @@ -163,47 +166,47 @@ int get_clocks(void)  						break;  				}  			} -			pcrvalue = pll->pcr & 0x00FF00FF; +			pcrvalue = in_be32(&pll->pcr) & 0x00FF00FF;  			fbtemp = ((i - 1) << 8) | ((i - 1) << 12);  			pcrvalue |= ((i << 24) | fbtemp); -			pll->pcr = pcrvalue; +			out_be32(&pll->pcr, pcrvalue);  		}  		gd->vco_clk = vco;	/* Vco clock */  	} else if (bootmode == 2) {  		/* Normal mode */ -		vco =  ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; +		vco =  ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;  		if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) {  			/* Default value */ -			pcrvalue = (pll->pcr & 0x00FFFFFF); -			pcrvalue |= pPllmult[ccm->ccr & fbpll_mask] << 24; -			pll->pcr = pcrvalue; -			vco =  ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; +			pcrvalue = (in_be32(&pll->pcr) & 0x00FFFFFF); +			pcrvalue |= pPllmult[in_be16(&ccm->ccr) & fbpll_mask] << 24; +			out_be32(&pll->pcr, pcrvalue); +			vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;  		}  		gd->vco_clk = vco;	/* Vco clock */  	} else if (bootmode == 3) {  		/* serial mode */ -		vco =  ((pll->pcr & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; +		vco =  ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;  		gd->vco_clk = vco;	/* Vco clock */  	} -	if ((ccm->ccr & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) { +	if ((in_be16(&ccm->ccr) & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) {  		/* Limp mode */  	} else {  		gd->inp_clk = CONFIG_SYS_INPUT_CLKSRC;	/* Input clock */ -		temp = (pll->pcr & PLL_PCR_OUTDIV1_MASK) + 1; +		temp = (in_be32(&pll->pcr) & PLL_PCR_OUTDIV1_MASK) + 1;  		gd->cpu_clk = vco / temp;	/* cpu clock */ -		temp = ((pll->pcr & PLL_PCR_OUTDIV2_MASK) >> 4) + 1; +		temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1;  		gd->bus_clk = vco / temp;	/* bus clock */ -		temp = ((pll->pcr & PLL_PCR_OUTDIV3_MASK) >> 8) + 1; +		temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV3_MASK) >> 8) + 1;  		gd->flb_clk = vco / temp;	/* FlexBus clock */  #ifdef CONFIG_PCI  		if (bPci) { -			temp = ((pll->pcr & PLL_PCR_OUTDIV4_MASK) >> 12) + 1; +			temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV4_MASK) >> 12) + 1;  			gd->pci_clk = vco / temp;	/* PCI clock */  		}  #endif diff --git a/arch/m68k/cpu/mcf547x_8x/cpu.c b/arch/m68k/cpu/mcf547x_8x/cpu.c index 7590f2c1c..157a8e41a 100644 --- a/arch/m68k/cpu/mcf547x_8x/cpu.c +++ b/arch/m68k/cpu/mcf547x_8x/cpu.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -31,19 +31,20 @@  #include <netdev.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR;  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -	volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); +	gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); -	gptmr->pre = 10; -	gptmr->cnt = 1; +	out_be16(&gptmr->pre, 10); +	out_be16(&gptmr->cnt, 1);  	/* enable watchdog, set timeout to 0 and wait */ -	gptmr->mode = GPT_TMS_SGPIO; -	gptmr->ctrl = GPT_CTRL_WDEN | GPT_CTRL_CE; +	out_8(&gptmr->mode, GPT_TMS_SGPIO); +	out_8(&gptmr->ctrl, GPT_CTRL_WDEN | GPT_CTRL_CE);  	/* we don't return! */  	return 1; @@ -51,12 +52,12 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int checkcpu(void)  { -	volatile siu_t *siu = (siu_t *) MMAP_SIU; +	siu_t *siu = (siu_t *) MMAP_SIU;  	u16 id = 0;  	puts("CPU:   "); -	switch ((siu->jtagid & 0x000FF000) >> 12) { +	switch ((in_be32(&siu->jtagid) & 0x000FF000) >> 12) {  	case 0x0C:  		id = 5485;  		break; @@ -111,18 +112,18 @@ int checkcpu(void)  /* Called by macro WATCHDOG_RESET */  void hw_watchdog_reset(void)  { -	volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); +	gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); -	gptmr->ocpw = 0xa5; +	out_8(&gptmr->ocpw, 0xa5);  }  int watchdog_disable(void)  { -	volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); +	gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);  	/* UserManual, once the wdog is disabled, wdog cannot be re-enabled */ -	gptmr->mode = 0; -	gptmr->ctrl = 0; +	out_8(&gptmr->mode, 0); +	out_8(&gptmr->ctrl, 0);  	puts("WATCHDOG:disabled\n"); @@ -131,14 +132,13 @@ int watchdog_disable(void)  int watchdog_init(void)  { +	gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); -	volatile gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR); +	out_be16(&gptmr->pre, CONFIG_WATCHDOG_TIMEOUT); +	out_be16(&gptmr->cnt, CONFIG_SYS_TIMER_PRESCALER * 1000); -	gptmr->pre = CONFIG_WATCHDOG_TIMEOUT; -	gptmr->cnt = CONFIG_SYS_TIMER_PRESCALER * 1000; - -	gptmr->mode = GPT_TMS_SGPIO; -	gptmr->ctrl = GPT_CTRL_CE | GPT_CTRL_WDEN; +	out_8(&gptmr->mode, GPT_TMS_SGPIO); +	out_8(&gptmr->ctrl, GPT_CTRL_CE | GPT_CTRL_WDEN);  	puts("WATCHDOG:enabled\n");  	return (0); diff --git a/arch/m68k/cpu/mcf547x_8x/cpu_init.c b/arch/m68k/cpu/mcf547x_8x/cpu_init.c index 60c91267a..4eb8a7c18 100644 --- a/arch/m68k/cpu/mcf547x_8x/cpu_init.c +++ b/arch/m68k/cpu/mcf547x_8x/cpu_init.c @@ -3,7 +3,7 @@   * (C) Copyright 2000-2003   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.   * - * (C) Copyright 2007 Freescale Semiconductor, Inc. + * (C) Copyright 2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -28,6 +28,7 @@  #include <common.h>  #include <MCD_dma.h>  #include <asm/immap.h> +#include <asm/io.h>  #if defined(CONFIG_CMD_NET)  #include <config.h> @@ -44,58 +45,59 @@   */  void cpu_init_f(void)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; -	volatile xlbarb_t *xlbarb = (volatile xlbarb_t *) MMAP_XARB; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS; +	xlbarb_t *xlbarb = (xlbarb_t *) MMAP_XARB; -	xlbarb->adrto = 0x2000; -	xlbarb->datto = 0x2500; -	xlbarb->busto = 0x3000; +	out_be32(&xlbarb->adrto, 0x2000); +	out_be32(&xlbarb->datto, 0x2500); +	out_be32(&xlbarb->busto, 0x3000); -	xlbarb->cfg = XARB_CFG_AT | XARB_CFG_DT; +	out_be32(&xlbarb->cfg, XARB_CFG_AT | XARB_CFG_DT);  	/* Master Priority Enable */ -	xlbarb->prien = 0xff; -	xlbarb->pri = 0; +	out_be32(&xlbarb->prien, 0xff); +	out_be32(&xlbarb->pri, 0);  #if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) && defined(CONFIG_SYS_CS0_CTRL)) -	fbcs->csar0 = CONFIG_SYS_CS0_BASE; -	fbcs->cscr0 = CONFIG_SYS_CS0_CTRL; -	fbcs->csmr0 = CONFIG_SYS_CS0_MASK; +	out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE); +	out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL); +	out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);  #endif  #if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) && defined(CONFIG_SYS_CS1_CTRL)) -	fbcs->csar1 = CONFIG_SYS_CS1_BASE; -	fbcs->cscr1 = CONFIG_SYS_CS1_CTRL; -	fbcs->csmr1 = CONFIG_SYS_CS1_MASK; +	out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE); +	out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL); +	out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);  #endif  #if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) && defined(CONFIG_SYS_CS2_CTRL)) -	fbcs->csar2 = CONFIG_SYS_CS2_BASE; -	fbcs->cscr2 = CONFIG_SYS_CS2_CTRL; -	fbcs->csmr2 = CONFIG_SYS_CS2_MASK; +	out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE); +	out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL); +	out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);  #endif  #if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) && defined(CONFIG_SYS_CS3_CTRL)) -	fbcs->csar3 = CONFIG_SYS_CS3_BASE; -	fbcs->cscr3 = CONFIG_SYS_CS3_CTRL; -	fbcs->csmr3 = CONFIG_SYS_CS3_MASK; +	out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE); +	out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL); +	out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);  #endif  #if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) && defined(CONFIG_SYS_CS4_CTRL)) -	fbcs->csar4 = CONFIG_SYS_CS4_BASE; -	fbcs->cscr4 = CONFIG_SYS_CS4_CTRL; -	fbcs->csmr4 = CONFIG_SYS_CS4_MASK; +	out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE); +	out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL); +	out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);  #endif  #if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) && defined(CONFIG_SYS_CS5_CTRL)) -	fbcs->csar5 = CONFIG_SYS_CS5_BASE; -	fbcs->cscr5 = CONFIG_SYS_CS5_CTRL; -	fbcs->csmr5 = CONFIG_SYS_CS5_MASK; +	out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE); +	out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL); +	out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);  #endif  #ifdef CONFIG_FSL_I2C -	gpio->par_feci2cirq = GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA; +	out_be16(&gpio->par_feci2cirq, +		GPIO_PAR_FECI2CIRQ_SCL | GPIO_PAR_FECI2CIRQ_SDA);  #endif  	icache_enable(); @@ -115,44 +117,44 @@ int cpu_init_r(void)  void uart_port_conf(int port)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; -	volatile u8 *pscsicr = (u8 *) (CONFIG_SYS_UART_BASE + 0x40); +	gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	u8 *pscsicr = (u8 *) (CONFIG_SYS_UART_BASE + 0x40);  	/* Setup Ports: */  	switch (port) {  	case 0: -		gpio->par_psc0 = (GPIO_PAR_PSC0_TXD0 | GPIO_PAR_PSC0_RXD0); +		out_8(&gpio->par_psc0, GPIO_PAR_PSC0_TXD0 | GPIO_PAR_PSC0_RXD0);  		break;  	case 1: -		gpio->par_psc1 = (GPIO_PAR_PSC1_TXD1 | GPIO_PAR_PSC1_RXD1); +		out_8(&gpio->par_psc1, GPIO_PAR_PSC1_TXD1 | GPIO_PAR_PSC1_RXD1);  		break;  	case 2: -		gpio->par_psc2 = (GPIO_PAR_PSC2_TXD2 | GPIO_PAR_PSC2_RXD2); +		out_8(&gpio->par_psc2, GPIO_PAR_PSC2_TXD2 | GPIO_PAR_PSC2_RXD2);  		break;  	case 3: -		gpio->par_psc3 = (GPIO_PAR_PSC3_TXD3 | GPIO_PAR_PSC3_RXD3); +		out_8(&gpio->par_psc3, GPIO_PAR_PSC3_TXD3 | GPIO_PAR_PSC3_RXD3);  		break;  	} -	*pscsicr &= 0xF8; +	clrbits_8(pscsicr, 0x07);  }  #if defined(CONFIG_CMD_NET)  int fecpin_setclear(struct eth_device *dev, int setclear)  { -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	struct fec_info_dma *info = (struct fec_info_dma *)dev->priv;  	if (setclear) {  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) -			gpio->par_feci2cirq |= 0xF000; +			setbits_be16(&gpio->par_feci2cirq, 0xf000);  		else -			gpio->par_feci2cirq |= 0x0FC0; +			setbits_be16(&gpio->par_feci2cirq, 0x0fc0);  	} else {  		if (info->iobase == CONFIG_SYS_FEC0_IOBASE) -			gpio->par_feci2cirq &= 0x0FFF; +			clrbits_be16(&gpio->par_feci2cirq, 0xf000);  		else -			gpio->par_feci2cirq &= 0xF03F; +			clrbits_be16(&gpio->par_feci2cirq, 0x0fc0);  	}  	return 0;  } diff --git a/arch/m68k/cpu/mcf547x_8x/interrupts.c b/arch/m68k/cpu/mcf547x_8x/interrupts.c index 76be876aa..d21543801 100644 --- a/arch/m68k/cpu/mcf547x_8x/interrupts.c +++ b/arch/m68k/cpu/mcf547x_8x/interrupts.c @@ -1,6 +1,6 @@  /*   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -25,14 +25,15 @@  /* CPU specific interrupt routine */  #include <common.h>  #include <asm/immap.h> +#include <asm/io.h>  int interrupt_init(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);  	/* Make sure all interrupts are disabled */ -	intp->imrh0 |= 0xFFFFFFFF; -	intp->imrl0 |= 0xFFFFFFFF; +	setbits_be32(&intp->imrh0, 0xffffffff); +	setbits_be32(&intp->imrl0, 0xffffffff);  	enable_interrupts(); @@ -42,9 +43,9 @@ int interrupt_init(void)  #if defined(CONFIG_SLTTMR)  void dtimer_intr_setup(void)  { -	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); +	int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE); -	intp->icr0[CONFIG_SYS_TMRINTR_NO] = CONFIG_SYS_TMRINTR_PRI; -	intp->imrh0 &= ~CONFIG_SYS_TMRINTR_MASK; +	out_8(&intp->icr0[CONFIG_SYS_TMRINTR_NO], CONFIG_SYS_TMRINTR_PRI); +	clrbits_be32(&intp->imrh0, CONFIG_SYS_TMRINTR_MASK);  }  #endif diff --git a/arch/m68k/cpu/mcf547x_8x/pci.c b/arch/m68k/cpu/mcf547x_8x/pci.c index f867dc127..1a81e3f04 100644 --- a/arch/m68k/cpu/mcf547x_8x/pci.c +++ b/arch/m68k/cpu/mcf547x_8x/pci.c @@ -1,5 +1,5 @@  /* - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -88,53 +88,56 @@ int pci_read_cfg_dword(struct pci_controller *hose, pci_dev_t dev,  void pci_mcf547x_8x_init(struct pci_controller *hose)  { -	volatile pci_t *pci = (volatile pci_t *) MMAP_PCI; -	volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO; +	pci_t *pci = (pci_t *) MMAP_PCI; +	gpio_t *gpio = (gpio_t *) MMAP_GPIO;  	/* Port configuration */ -	gpio->par_pcibg = -	    GPIO_PAR_PCIBG_PCIBG0(3) | GPIO_PAR_PCIBG_PCIBG1(3) | -	    GPIO_PAR_PCIBG_PCIBG2(3) | GPIO_PAR_PCIBG_PCIBG3(3) | -	    GPIO_PAR_PCIBG_PCIBG4(3); -	gpio->par_pcibr = -	    GPIO_PAR_PCIBR_PCIBR0(3) | GPIO_PAR_PCIBR_PCIBR1(3) | -	    GPIO_PAR_PCIBR_PCIBR2(3) | GPIO_PAR_PCIBR_PCIBR3(3) | -	    GPIO_PAR_PCIBR_PCIBR4(3); +	out_be16(&gpio->par_pcibg, +		GPIO_PAR_PCIBG_PCIBG0(3) | GPIO_PAR_PCIBG_PCIBG1(3) | +		GPIO_PAR_PCIBG_PCIBG2(3) | GPIO_PAR_PCIBG_PCIBG3(3) | +		GPIO_PAR_PCIBG_PCIBG4(3)); +	out_be16(&gpio->par_pcibr, +		GPIO_PAR_PCIBR_PCIBR0(3) | GPIO_PAR_PCIBR_PCIBR1(3) | +		GPIO_PAR_PCIBR_PCIBR2(3) | GPIO_PAR_PCIBR_PCIBR3(3) | +		GPIO_PAR_PCIBR_PCIBR4(3));  	/* Assert reset bit */ -	pci->gscr |= PCI_GSCR_PR; +	setbits_be32(&pci->gscr, PCI_GSCR_PR); -	pci->tcr1 = PCI_TCR1_P; +	out_be32(&pci->tcr1, PCI_TCR1_P);  	/* Initiator windows */ -	pci->iw0btar = CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16); -	pci->iw1btar = CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16); -	pci->iw2btar = CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16); +	out_be32(&pci->iw0btar, +		CONFIG_SYS_PCI_MEM_PHYS | (CONFIG_SYS_PCI_MEM_PHYS >> 16)); +	out_be32(&pci->iw1btar, +		CONFIG_SYS_PCI_IO_PHYS | (CONFIG_SYS_PCI_IO_PHYS >> 16)); +	out_be32(&pci->iw2btar, +		CONFIG_SYS_PCI_CFG_PHYS | (CONFIG_SYS_PCI_CFG_PHYS >> 16)); -	pci->iwcr = -	    PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | -	    PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO; +	out_be32(&pci->iwcr, +		PCI_IWCR_W0C_EN | PCI_IWCR_W1C_EN | PCI_IWCR_W1C_IO | +		PCI_IWCR_W2C_EN | PCI_IWCR_W2C_IO); -	pci->icr = 0; +	out_be32(&pci->icr, 0);  	/* Enable bus master and mem access */ -	pci->scr = PCI_SCR_B | PCI_SCR_M; +	out_be32(&pci->scr, PCI_SCR_B | PCI_SCR_M);  	/* Cache line size and master latency */ -	pci->cr1 = PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xF8); -	pci->cr2 = 0; +	out_be32(&pci->cr1, PCI_CR1_CLS(8) | PCI_CR1_LTMR(0xf8)); +	out_be32(&pci->cr2, 0);  #ifdef CONFIG_SYS_PCI_BAR0 -	pci->bar0 = PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0); -	pci->tbatr0a = CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN; +	out_be32(&pci->bar0, PCI_BAR_BAR0(CONFIG_SYS_PCI_BAR0)); +	out_be32(&pci->tbatr0a, CONFIG_SYS_PCI_TBATR0 | PCI_TBATR_EN);  #endif  #ifdef CONFIG_SYS_PCI_BAR1 -	pci->bar1 = PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1); -	pci->tbatr1a = CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN; +	out_be32(&pci->bar1, PCI_BAR_BAR1(CONFIG_SYS_PCI_BAR1)); +	out_be32(&pci->tbatr1a, CONFIG_SYS_PCI_TBATR1 | PCI_TBATR_EN);  #endif  	/* Deassert reset bit */ -	pci->gscr &= ~PCI_GSCR_PR; +	clrbits_be32(&pci->gscr, PCI_GSCR_PR);  	udelay(1000);  	/* Enable PCI bus master support */ diff --git a/arch/m68k/cpu/mcf547x_8x/slicetimer.c b/arch/m68k/cpu/mcf547x_8x/slicetimer.c index ee2e35bd5..25dd2aed5 100644 --- a/arch/m68k/cpu/mcf547x_8x/slicetimer.c +++ b/arch/m68k/cpu/mcf547x_8x/slicetimer.c @@ -1,5 +1,5 @@  /* - * (C) Copyright 2007 Freescale Semiconductor, Inc. + * (C) Copyright 2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -25,6 +25,7 @@  #include <asm/timer.h>  #include <asm/immap.h> +#include <asm/io.h>  DECLARE_GLOBAL_DATA_PTR; @@ -42,31 +43,32 @@ extern void dtimer_intr_setup(void);  void __udelay(unsigned long usec)  { -	volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE); +	slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE);  	u32 now, freq;  	/* 1 us period */  	freq = CONFIG_SYS_TIMER_PRESCALER; -	timerp->cr = 0;		/* Disable */ -	timerp->tcnt = usec * freq; -	timerp->cr = SLT_CR_TEN; +	/* Disable */ +	out_be32(&timerp->cr, 0); +	out_be32(&timerp->tcnt, usec * freq); +	out_be32(&timerp->cr, SLT_CR_TEN); -	now = timerp->cnt; +	now = in_be32(&timerp->cnt);  	while (now != 0) -		now = timerp->cnt; +		now = in_be32(&timerp->cnt); -	timerp->sr |= SLT_SR_ST; -	timerp->cr = 0; +	setbits_be32(&timerp->sr, SLT_SR_ST); +	out_be32(&timerp->cr, 0);  }  void dtimer_interrupt(void *not_used)  { -	volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); +	slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE);  	/* check for timer interrupt asserted */  	if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) { -		timerp->sr |= SLT_SR_ST; +		setbits_be32(&timerp->sr, SLT_SR_ST);  		timestamp++;  		return;  	} @@ -74,25 +76,27 @@ void dtimer_interrupt(void *not_used)  int timer_init(void)  { -	volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE); +	slt_t *timerp = (slt_t *) (CONFIG_SYS_TMR_BASE);  	timestamp = 0; -	timerp->cr = 0;		/* disable timer */ -	timerp->tcnt = 0; -	timerp->sr = SLT_SR_BE | SLT_SR_ST;	/* clear status */ +	/* disable timer */ +	out_be32(&timerp->cr, 0); +	out_be32(&timerp->tcnt, 0); +	/* clear status */ +	out_be32(&timerp->sr, SLT_SR_BE | SLT_SR_ST);  	/* initialize and enable timer interrupt */  	irq_install_handler(CONFIG_SYS_TMRINTR_NO, dtimer_interrupt, 0);  	/* Interrupt every ms */ -	timerp->tcnt = 1000 * CONFIG_SYS_TIMER_PRESCALER; +	out_be32(&timerp->tcnt, 1000 * CONFIG_SYS_TIMER_PRESCALER);  	dtimer_intr_setup();  	/* set a period of 1us, set timer mode to restart and  	   enable timer and interrupt */ -	timerp->cr = SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN; +	out_be32(&timerp->cr, SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN);  	return 0;  } diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index ad971b4f3..525d90ccb 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -17,41 +17,36 @@ extern int test_and_change_bit(int nr, volatile void *addr);  #ifdef __KERNEL__ -/* - * ffs: find first bit set. This is defined the same way as - * the libc and compiler builtin ffs routines, therefore - * differs in spirit from the above ffz (man ffs). - */ -extern __inline__ int ffs(int x) + +extern inline int test_bit(int nr, __const__ volatile void *addr) +{ +	__const__ unsigned int *p = (__const__ unsigned int *) addr; + +	return (p[nr >> 5] & (1UL << (nr & 31))) != 0; +} + +extern inline int test_and_set_bit(int nr, volatile void *vaddr)  { -	int r = 1; +	char retval; + +	volatile char *p = &((volatile char *)vaddr)[(nr^31) >> 3]; +	__asm__ __volatile__ ("bset %2,(%4); sne %0" +	     : "=d" (retval), "=m" (*p) +	     : "di" (nr & 7), "m" (*p), "a" (p)); -	if (!x) -		return 0; -	if (!(x & 0xffff)) { -		x >>= 16; -		r += 16; -	} -	if (!(x & 0xff)) { -		x >>= 8; -		r += 8; -	} -	if (!(x & 0xf)) { -		x >>= 4; -		r += 4; -	} -	if (!(x & 3)) { -		x >>= 2; -		r += 2; -	} -	if (!(x & 1)) { -		x >>= 1; -		r += 1; -	} -	return r; +	return retval;  } +  #define __ffs(x) (ffs(x) - 1) -#define PLATFORM_FFS + +/* + *  * hweightN: returns the hamming weight (i.e. the number + *   * of bits set) of a N-bit word + *    */ + +#define hweight32(x) generic_hweight32(x) +#define hweight16(x) generic_hweight16(x) +#define hweight8(x) generic_hweight8(x)  #endif /* __KERNEL__ */ diff --git a/arch/m68k/include/asm/coldfire/flexbus.h b/arch/m68k/include/asm/coldfire/flexbus.h index 51cbbd8b2..9a3078a14 100644 --- a/arch/m68k/include/asm/coldfire/flexbus.h +++ b/arch/m68k/include/asm/coldfire/flexbus.h @@ -29,7 +29,57 @@  /*********************************************************************  * FlexBus Chip Selects (FBCS)  *********************************************************************/ +#ifdef CONFIG_M5235 +typedef struct fbcs { +    u16 csar0;      /* Chip-select Address */ +    u16 res1; +    u32 csmr0;      /* Chip-select Mask */ +    u16 res2; +    u16 cscr0;      /* Chip-select Control */ + +    u16 csar1; +    u16 res3; +    u32 csmr1; +    u16 res4; +    u16 cscr1; + +    u16 csar2; +    u16 res5; +    u32 csmr2; +    u16 res6; +    u16 cscr2; + +    u16 csar3; +    u16 res7; +    u32 csmr3; +    u16 res8; +    u16 cscr3; + +    u16 csar4; +    u16 res9; +    u32 csmr4; +    u16 res10; +    u16 cscr4; + +    u16 csar5; +    u16 res11; +    u32 csmr5; +    u16 res12; +    u16 cscr5; +    u16 csar6; +    u16 res13; +    u32 csmr6; +    u16 res14; +    u16 cscr6; + +    u16 csar7; +    u16 res15; +    u32 csmr7; +    u16 res16; +    u16 cscr7; +} fbcs_t; +#else  typedef struct fbcs {  	u32 csar0;		/* Chip-select Address */  	u32 csmr0;		/* Chip-select Mask */ @@ -56,6 +106,7 @@ typedef struct fbcs {  	u32 csmr7;  	u32 cscr7;  } fbcs_t; +#endif  #define FBCS_CSAR_BA(x)			((x) & 0xFFFF0000) @@ -94,6 +145,22 @@ typedef struct fbcs {  #endif  #define FBCS_CSMR_V			(0x00000001)	/* Valid bit */ +#ifdef CONFIG_M5235 +#define FBCS_CSCR_SRWS(x)       (((x) & 0x3) << 14) +#define FBCS_CSCR_IWS(x)        (((x) & 0xF) << 10) +#define FBCS_CSCR_AA_ON         (1 << 8) +#define FBCS_CSCR_AA_OFF        (0 << 8) +#define FBCS_CSCR_PS_32         (0 << 6) +#define FBCS_CSCR_PS_16         (2 << 6) +#define FBCS_CSCR_PS_8          (1 << 6) +#define FBCS_CSCR_BEM_ON        (1 << 5) +#define FBCS_CSCR_BEM_OFF       (0 << 5) +#define FBCS_CSCR_BSTR_ON       (1 << 4) +#define FBCS_CSCR_BSTR_OFF      (0 << 4) +#define FBCS_CSCR_BSTW_ON       (1 << 3) +#define FBCS_CSCR_BSTW_OFF      (0 << 3) +#define FBCS_CSCR_SWWS(x)       (((x) & 0x7) << 0) +#else  #define FBCS_CSCR_SWS(x)		(((x) & 0x3F) << 26)  #define FBCS_CSCR_SWS_MASK		(0x03FFFFFF)  #define FBCS_CSCR_SWSEN			(0x00800000) @@ -116,5 +183,6 @@ typedef struct fbcs {  #define FBCS_CSCR_PS_16			(0x00000080)  #define FBCS_CSCR_PS_8			(0x00000040)  #define FBCS_CSCR_PS_32			(0x00000000) +#endif  #endif				/* __FLEXBUS_H */ diff --git a/arch/m68k/include/asm/coldfire/qspi.h b/arch/m68k/include/asm/coldfire/qspi.h index 8bcd2e4db..9fd98f6c0 100644 --- a/arch/m68k/include/asm/coldfire/qspi.h +++ b/arch/m68k/include/asm/coldfire/qspi.h @@ -98,7 +98,7 @@ typedef struct qspi_ctrl {  #define QSPI_QAR_RECV			(0x0010)  #define QSPI_QAR_CMD			(0x0020) -/* DR */ +/* DR with RAM command word definitions */  #define QSPI_QDR_CONT			(0x8000)  #define QSPI_QDR_BITSE			(0x4000)  #define QSPI_QDR_DT			(0x2000) diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index d86eaf95e..50ed74989 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -1,7 +1,7 @@  /*   * IO header file   * - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. + * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.   * TsiChung Liew (Tsi-Chung.Liew@freescale.com)   *   * See file CREDITS for list of people who contributed to this @@ -225,6 +225,42 @@ extern inline void out_be32(volatile unsigned *addr, int val)  	*addr = val;  } +/* Clear and set bits in one shot. These macros can be used to clear and + * set multiple bits in a register using a single call. These macros can + * also be used to set a multiple-bit bit pattern using a mask, by + * specifying the mask in the 'clear' parameter and the new bit pattern + * in the 'set' parameter. + */ + +#define clrbits(type, addr, clear) \ +	out_##type((addr), in_##type(addr) & ~(clear)) + +#define setbits(type, addr, set) \ +	out_##type((addr), in_##type(addr) | (set)) + +#define clrsetbits(type, addr, clear, set) \ +	out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) + +#define clrbits_be32(addr, clear) clrbits(be32, addr, clear) +#define setbits_be32(addr, set) setbits(be32, addr, set) +#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set) + +#define clrbits_le32(addr, clear) clrbits(le32, addr, clear) +#define setbits_le32(addr, set) setbits(le32, addr, set) +#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set) + +#define clrbits_be16(addr, clear) clrbits(be16, addr, clear) +#define setbits_be16(addr, set) setbits(be16, addr, set) +#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set) + +#define clrbits_le16(addr, clear) clrbits(le16, addr, clear) +#define setbits_le16(addr, set) setbits(le16, addr, set) +#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set) + +#define clrbits_8(addr, clear) clrbits(8, addr, clear) +#define setbits_8(addr, set) setbits(8, addr, set) +#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) +  static inline void sync(void)  {  	/* This sync function is for PowerPC or other architecture instruction diff --git a/arch/m68k/include/asm/m5271.h b/arch/m68k/include/asm/m5271.h index d25261bcd..b2bc05111 100644 --- a/arch/m68k/include/asm/m5271.h +++ b/arch/m68k/include/asm/m5271.h @@ -171,6 +171,32 @@  #define MCF_GPIO_PAR_UART_U1RXD_UART1		0x0C00  #define MCF_GPIO_PAR_UART_U1TXD_UART1		0x0300 +/* Bit definitions and macros for PAR_QSPI */ +#define MCF_GPIO_PAR_QSPI_PCS1_UNMASK		0x3F +#define MCF_GPIO_PAR_QSPI_PCS1_PCS1		0xC0 +#define MCF_GPIO_PAR_QSPI_PCS1_SDRAM_SCKE	0x80 +#define MCF_GPIO_PAR_QSPI_PCS1_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_PCS0_UNMASK		0xDF +#define MCF_GPIO_PAR_QSPI_PCS0_PCS0		0x20 +#define MCF_GPIO_PAR_QSPI_PCS0_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SIN_UNMASK		0xE7 +#define MCF_GPIO_PAR_QSPI_SIN_SIN		0x18 +#define MCF_GPIO_PAR_QSPI_SIN_I2C_SDA		0x10 +#define MCF_GPIO_PAR_QSPI_SIN_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SOUT_UNMASK		0xFB +#define MCF_GPIO_PAR_QSPI_SOUT_SOUT		0x04 +#define MCF_GPIO_PAR_QSPI_SOUT_GPIO		0x00 +#define MCF_GPIO_PAR_QSPI_SCK_UNMASK		0xFC +#define MCF_GPIO_PAR_QSPI_SCK_SCK		0x03 +#define MCF_GPIO_PAR_QSPI_SCK_I2C_SCL		0x02 +#define MCF_GPIO_PAR_QSPI_SCK_GPIO		0x00 + +/* Bit definitions and macros for PAR_TIMER for QSPI */ +#define MCF_GPIO_PAR_TIMER_T3IN_UNMASK		0x3FFF +#define MCF_GPIO_PAR_TIMER_T3IN_QSPI_PCS2	0x4000 +#define MCF_GPIO_PAR_TIMER_T3OUT_UNMASK		0xFF3F +#define MCF_GPIO_PAR_TIMER_T3OUT_QSPI_PCS3	0x0040 +  #define MCF_GPIO_PAR_SDRAM_PAR_CSSDCS(x)	(((x)&0x03)<<6)  #define MCF_SDRAMC_DCR				0x000040 diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk index aca79e261..b4935f0a5 100644 --- a/arch/microblaze/config.mk +++ b/arch/microblaze/config.mk @@ -31,3 +31,5 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000  PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__  LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds + +CONFIG_ARCH_DEVICE_TREE := microblaze diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c index ee6708218..7f2ee64ca 100644 --- a/arch/microblaze/cpu/interrupts.c +++ b/arch/microblaze/cpu/interrupts.c @@ -32,15 +32,12 @@  #undef DEBUG_INT -extern void microblaze_disable_interrupts (void); -extern void microblaze_enable_interrupts (void); - -void enable_interrupts (void) +void enable_interrupts(void)  {  	MSRSET(0x2);  } -int disable_interrupts (void) +int disable_interrupts(void)  {  	unsigned int msr; @@ -58,20 +55,21 @@ microblaze_intc_t *intc;  /* default handler */  static void def_hdlr(void)  { -	puts ("def_hdlr\n"); +	puts("def_hdlr\n");  }  static void enable_one_interrupt(int irq)  {  	int mask;  	int offset = 1; +  	offset <<= irq;  	mask = intc->ier;  	intc->ier = (mask | offset);  #ifdef DEBUG_INT -	printf ("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask, +	printf("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,  		intc->ier); -	printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier, +	printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,  		intc->iar, intc->mer);  #endif  } @@ -80,25 +78,26 @@ static void disable_one_interrupt(int irq)  {  	int mask;  	int offset = 1; +  	offset <<= irq;  	mask = intc->ier;  	intc->ier = (mask & ~offset);  #ifdef DEBUG_INT -	printf ("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask, +	printf("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,  		intc->ier); -	printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier, +	printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,  		intc->iar, intc->mer);  #endif  } -/* adding new handler for interrupt */ -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg) +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)  {  	struct irq_action *act; +  	/* irq out of range */  	if ((irq < 0) || (irq > irq_no)) { -		puts ("IRQ out of range\n"); -		return; +		puts("IRQ out of range\n"); +		return -1;  	}  	act = &vecs[irq];  	if (hdlr) {		/* enable */ @@ -106,11 +105,14 @@ void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg)  		act->arg = arg;  		act->count = 0;  		enable_one_interrupt (irq); -	} else {		/* disable */ -		act->handler = (interrupt_handler_t *) def_hdlr; -		act->arg = (void *)irq; -		disable_one_interrupt (irq); +		return 0;  	} + +	/* Disable */ +	act->handler = (interrupt_handler_t *) def_hdlr; +	act->arg = (void *)irq; +	disable_one_interrupt(irq); +	return 1;  }  /* initialization interrupt controller - hardware */ @@ -122,7 +124,7 @@ static void intc_init(void)  	/* XIntc_Start - hw_interrupt enable and all interrupt enable */  	intc->mer = 0x3;  #ifdef DEBUG_INT -	printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier, +	printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,  		intc->iar, intc->mer);  #endif  } @@ -157,7 +159,7 @@ int interrupts_init(void)  	return 0;  } -void interrupt_handler (void) +void interrupt_handler(void)  {  	int irqs = intc->ivr;	/* find active interrupt */  	int mask = 1; diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S index 8a2f634a9..8564c4e30 100644 --- a/arch/microblaze/cpu/start.S +++ b/arch/microblaze/cpu/start.S @@ -149,7 +149,7 @@ clear_bss:  	cmp     r6, r5, r4 /* check if we have reach the end */  	bnei    r6, 2b  3:	/* jumping to board_init */ -	brai	board_init +	brai	board_init_f  1:	bri	1b  /* diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c index cc6b897fb..1330401a9 100644 --- a/arch/microblaze/cpu/timer.c +++ b/arch/microblaze/cpu/timer.c @@ -27,42 +27,30 @@  #include <asm/microblaze_intc.h>  volatile int timestamp = 0; +microblaze_timer_t *tmr; -#ifdef CONFIG_SYS_TIMER_0  ulong get_timer (ulong base)  { -	return (timestamp - base); +	if (tmr) +		return timestamp - base; +	return timestamp++ - base;  } -#else -ulong get_timer (ulong base) -{ -	return (timestamp++ - base); -} -#endif -#ifdef CONFIG_SYS_TIMER_0  void __udelay(unsigned long usec)  { -	int i; +	u32 i; -	i = get_timer(0); -	while ((get_timer(0) - i) < (usec / 1000)) -		; +	if (tmr) { +		i = get_timer(0); +		while ((get_timer(0) - i) < (usec / 1000)) +			; +	} else { +		for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 10000000); i++) +			; +	}  } -#else -void __udelay(unsigned long usec) -{ -	unsigned int i; -	for (i = 0; i < (usec * CONFIG_XILINX_CLOCK_FREQ / 10000000); i++) -		; -} -#endif - -#ifdef CONFIG_SYS_TIMER_0 -microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR); - -void timer_isr (void *arg) +static void timer_isr(void *arg)  {  	timestamp++;  	tmr->control = tmr->control | TIMER_INTERRUPT; @@ -70,15 +58,30 @@ void timer_isr (void *arg)  int timer_init (void)  { -	tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD; -	tmr->control = TIMER_INTERRUPT | TIMER_RESET; -	tmr->control = -	    TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT; -	timestamp = 0; -	install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr); +	int irq = -1; +	u32 preload = 0; +	u32 ret = 0; + +#if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM) +	preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ; +	irq = CONFIG_SYS_TIMER_0_IRQ; +	tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR); +#endif + +	if (tmr && preload && irq >= 0) { +		tmr->loadreg = preload; +		tmr->control = TIMER_INTERRUPT | TIMER_RESET; +		tmr->control = TIMER_ENABLE | TIMER_ENABLE_INTR |\ +					TIMER_RELOAD | TIMER_DOWN_COUNT; +		timestamp = 0; +		ret = install_interrupt_handler (irq, timer_isr, (void *)tmr); +		if (ret) +			tmr = NULL; +	} + +	/* No problem if timer is not found/initialized */  	return 0;  } -#endif  /*   * This function is derived from PowerPC code (read timebase as long long). diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds index ee41145bb..d033a2835 100644 --- a/arch/microblaze/cpu/u-boot.lds +++ b/arch/microblaze/cpu/u-boot.lds @@ -45,6 +45,7 @@ SECTIONS  	.data ALIGN(0x4):  	{  		__data_start = .; +		dts/libdts.o (.data)  		*(.data)  		__data_end = .;  	} diff --git a/arch/microblaze/include/asm/global_data.h b/arch/microblaze/include/asm/global_data.h index 0dc4ce9ee..de3b8dbe9 100644 --- a/arch/microblaze/include/asm/global_data.h +++ b/arch/microblaze/include/asm/global_data.h @@ -41,6 +41,7 @@ typedef	struct	global_data {  	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */  #endif  	unsigned long	env_addr;	/* Address  of Environment struct */ +	const void	*fdt_blob;	/* Our device tree, NULL if none */  	unsigned long	env_valid;	/* Checksum of Environment valid? */  	unsigned long	fb_base;	/* base address of frame buffer */  	void		**jt;		/* jump table */ diff --git a/arch/microblaze/include/asm/microblaze_intc.h b/arch/microblaze/include/asm/microblaze_intc.h index 6142b9c99..e9640f543 100644 --- a/arch/microblaze/include/asm/microblaze_intc.h +++ b/arch/microblaze/include/asm/microblaze_intc.h @@ -39,7 +39,16 @@ struct irq_action {  	int count; /* number of interrupt */  }; -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, +/** + * Register and unregister interrupt handler rutines + * + * @param irq	IRQ number + * @param hdlr	Interrupt handler rutine + * @param arg	Pointer to argument which is passed to int. handler rutine + * @return	0 if registration pass, 1 if unregistration pass, + *		or an error code < 0 otherwise + */ +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,  				       void *arg);  int interrupts_init(void); diff --git a/arch/microblaze/include/asm/microblaze_timer.h b/arch/microblaze/include/asm/microblaze_timer.h index 844c8db11..28e8b027c 100644 --- a/arch/microblaze/include/asm/microblaze_timer.h +++ b/arch/microblaze/include/asm/microblaze_timer.h @@ -39,3 +39,6 @@ typedef volatile struct microblaze_timer_t {  	int loadreg; /* load register TLR */  	int counter; /* timer/counter register */  } microblaze_timer_t; + +int timer_init(void); + diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 2295d0a46..2c4d5ffc5 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h @@ -28,4 +28,7 @@  extern char __end[];  extern char __text_start[]; +/* Microblaze board initialization function */ +void board_init(void); +  #endif /* __ASM_MICROBLAZE_PROCESSOR_H */ diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index b80250a6b..674b57319 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -32,21 +32,13 @@  #include <stdio_dev.h>  #include <serial.h>  #include <net.h> +#include <linux/compiler.h>  #include <asm/processor.h>  #include <asm/microblaze_intc.h> +#include <fdtdec.h>  DECLARE_GLOBAL_DATA_PTR; -#ifdef CONFIG_SYS_GPIO_0 -extern int gpio_init (void); -#endif -#ifdef CONFIG_SYS_TIMER_0 -extern int timer_init (void); -#endif -#ifdef CONFIG_SYS_FSL_2 -extern void fsl_init2 (void); -#endif -  /*   * All attempts to come up with a "common" initialization sequence   * that works for all boards and architectures failed: some of the @@ -63,31 +55,26 @@ typedef int (init_fnc_t) (void);  init_fnc_t *init_sequence[] = {  	env_init, +#ifdef CONFIG_OF_CONTROL +	fdtdec_check_fdt, +#endif  	serial_init,  	console_init_f, -#ifdef CONFIG_SYS_GPIO_0 -	gpio_init, -#endif  	interrupts_init, -#ifdef CONFIG_SYS_TIMER_0  	timer_init, -#endif -#ifdef CONFIG_SYS_FSL_2 -	fsl_init2, -#endif  	NULL,  };  unsigned long monitor_flash_len; -void board_init (void) +void board_init_f(ulong not_used)  {  	bd_t *bd;  	init_fnc_t **init_fnc_ptr;  	gd = (gd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);  	bd = (bd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \  						- GENERATED_BD_INFO_SIZE); -	char *s; +	__maybe_unused char *s;  #if defined(CONFIG_CMD_FLASH)  	ulong flash_size = 0;  #endif @@ -103,6 +90,17 @@ void board_init (void)  	monitor_flash_len = __end - __text_start; +#ifdef CONFIG_OF_EMBED +	/* Get a pointer to the FDT */ +	gd->fdt_blob = _binary_dt_dtb_start; +#elif defined CONFIG_OF_SEPARATE +	/* FDT is at end of image */ +	gd->fdt_blob = (void *)__end; +#endif +	/* Allow the early environment to override the fdt address */ +	gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16, +						(uintptr_t)gd->fdt_blob); +  	/*  	 * The Malloc area is immediately below the monitor copy in DRAM  	 * aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off @@ -121,6 +119,15 @@ void board_init (void)  		}  	} +#ifdef CONFIG_OF_CONTROL +	/* For now, put this check after the console is ready */ +	if (fdtdec_prepare_fdt()) { +		panic("** CONFIG_OF_CONTROL defined but no FDT - please see " +			"doc/README.fdt-control"); +	} else +		printf("DTB: 0x%x\n", (u32)gd->fdt_blob); +#endif +  	puts ("SDRAM :\n");  	printf ("\t\tIcache:%s\n", icache_status() ? "ON" : "OFF");  	printf ("\t\tDcache:%s\n", dcache_status() ? "ON" : "OFF"); @@ -129,9 +136,8 @@ void board_init (void)  #if defined(CONFIG_CMD_FLASH)  	puts ("Flash: ");  	bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; -	if (0 < (flash_size = flash_init ())) { -		bd->bi_flashsize = flash_size; -		bd->bi_flashoffset = CONFIG_SYS_FLASH_BASE + flash_size; +	flash_size = flash_init(); +	if (bd->bi_flashstart && flash_size > 0) {  # ifdef CONFIG_SYS_FLASH_CHECKSUM  		print_size (flash_size, "");  		/* @@ -142,13 +148,16 @@ void board_init (void)  		s = getenv ("flashchecksum");  		if (s && (*s == 'y')) {  			printf ("  CRC: %08X", -				crc32 (0, (const unsigned char *) CONFIG_SYS_FLASH_BASE, flash_size) +				crc32(0, (const u8 *)bd->bi_flashstart, +							flash_size)  			);  		}  		putc ('\n');  # else	/* !CONFIG_SYS_FLASH_CHECKSUM */  		print_size (flash_size, "\n");  # endif /* CONFIG_SYS_FLASH_CHECKSUM */ +		bd->bi_flashsize = flash_size; +		bd->bi_flashoffset = bd->bi_flashstart + flash_size;  	} else {  		puts ("Flash init FAILED");  		bd->bi_flashstart = 0; @@ -169,6 +178,8 @@ void board_init (void)  	/* Initialize the console (after the relocation and devices init) */  	console_init_r(); +	board_init(); +  	/* Initialize from environment */  	load_addr = getenv_ulong("loadaddr", 16, load_addr); diff --git a/arch/mips/config.mk b/arch/mips/config.mk index 6ab8acdb1..de9140b67 100644 --- a/arch/mips/config.mk +++ b/arch/mips/config.mk @@ -23,7 +23,21 @@  CROSS_COMPILE ?= mips_4KC- -CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds +# Handle special prefix in ELDK 4.0 toolchain +ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) +ENDIANNESS := -EL +endif + +ifdef CONFIG_SYS_LITTLE_ENDIAN +ENDIANNESS := -EL +endif + +ifdef CONFIG_SYS_BIG_ENDIAN +ENDIANNESS := -EB +endif + +# Default to EB if no endianess is configured +ENDIANNESS ?= -EB  PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__ @@ -47,8 +61,8 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__  # On the other hand, we want PIC in the U-Boot code to relocate it from ROM  # to RAM. $28 is always used as gp.  # -PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic +PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic $(ENDIANNESS)  PLATFORM_CPPFLAGS		+= -msoft-float -PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib +PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib $(ENDIANNESS)  PLATFORM_RELFLAGS		+= -ffunction-sections -fdata-sections  LDFLAGS_FINAL			+= --gc-sections diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk index a1cd590a0..481e9844d 100644 --- a/arch/mips/cpu/mips32/config.mk +++ b/arch/mips/cpu/mips32/config.mk @@ -29,21 +29,6 @@  #  MIPSFLAGS := -march=mips32r2 -# Handle special prefix in ELDK 4.0 toolchain -ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) -ENDIANNESS := -EL -endif +PLATFORM_CPPFLAGS += $(MIPSFLAGS) -ifdef CONFIG_SYS_LITTLE_ENDIAN -ENDIANNESS := -EL -endif - -ifdef CONFIG_SYS_BIG_ENDIAN -ENDIANNESS := -EB -endif - -# Default to EB if no endianess is configured -ENDIANNESS ?= -EB - -PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANNESS) -PLATFORM_LDFLAGS += $(ENDIANNESS) +CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds diff --git a/arch/mips/cpu/xburst/config.mk b/arch/mips/cpu/xburst/config.mk index bce0c1bcb..1536746c9 100644 --- a/arch/mips/cpu/xburst/config.mk +++ b/arch/mips/cpu/xburst/config.mk @@ -20,5 +20,6 @@  # MA 02111-1307 USA  # -PLATFORM_CPPFLAGS += -march=mips32 -EL -PLATFORM_LDFLAGS += -EL +PLATFORM_CPPFLAGS += -march=mips32 + +CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds diff --git a/arch/mips/cpu/xburst/cpu.c b/arch/mips/cpu/xburst/cpu.c index e97634159..ddcbfaa47 100644 --- a/arch/mips/cpu/xburst/cpu.c +++ b/arch/mips/cpu/xburst/cpu.c @@ -62,7 +62,7 @@ void __attribute__((weak)) _machine_restart(void)  	writew(100, &wdt->tdr); /* wdt_set_data(100) */  	writew(0, &wdt->tcnt); /* wdt_set_count(0); */ -	writew(TCU_TSSR_WDTSC, &tcu->tscr); /* tcu_start_wdt_clock */ +	writel(TCU_TSSR_WDTSC, &tcu->tscr); /* tcu_start_wdt_clock */  	writeb(readb(&wdt->tcer) | WDT_TCER_TCEN, &wdt->tcer); /* wdt start */  	while (1) diff --git a/arch/mips/cpu/xburst/timer.c b/arch/mips/cpu/xburst/timer.c index de6f5daa3..b6b3855ea 100644 --- a/arch/mips/cpu/xburst/timer.c +++ b/arch/mips/cpu/xburst/timer.c @@ -34,13 +34,13 @@ static struct jz4740_tcu *tcu = (struct jz4740_tcu *)JZ4740_TCU_BASE;  void reset_timer_masked(void)  {  	/* reset time */ -	gd->lastinc = readw(&tcu->tcnt0); +	gd->lastinc = readl(&tcu->tcnt0);  	gd->tbl = 0;  }  ulong get_timer_masked(void)  { -	ulong now = readw(&tcu->tcnt0); +	ulong now = readl(&tcu->tcnt0);  	if (gd->lastinc <= now)  		gd->tbl += now - gd->lastinc; /* normal mode */ @@ -83,11 +83,11 @@ void udelay_masked(unsigned long usec)  int timer_init(void)  { -	writew(TCU_TCSR_PRESCALE256 | TCU_TCSR_EXT_EN, &tcu->tcsr0); +	writel(TCU_TCSR_PRESCALE256 | TCU_TCSR_EXT_EN, &tcu->tcsr0); -	writew(0, &tcu->tcnt0); -	writew(0, &tcu->tdhr0); -	writew(TIMER_FDATA, &tcu->tdfr0); +	writel(0, &tcu->tcnt0); +	writel(0, &tcu->tdhr0); +	writel(TIMER_FDATA, &tcu->tdfr0);  	/* mask irqs */  	writel((1 << TIMER_CHAN) | (1 << (TIMER_CHAN + 16)), &tcu->tmsr); diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 9244f3151..967e98a52 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -25,6 +25,13 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(ARCH).o +## Build a couple of necessary functions into a private libgcc +LIBGCC	= $(obj)libgcc.o +GLSOBJS	+= ashldi3.o +GLSOBJS	+= ashrdi3.o +GLSOBJS	+= lshrdi3.o +LGOBJS	:= $(addprefix $(obj),$(GLSOBJS)) +  SOBJS-y	+=  COBJS-y	+= board.o @@ -37,9 +44,22 @@ endif  SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)  OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) +# Always build libmips.o +TARGETS	:= $(LIB) + +# Build private libgcc only when asked for +ifdef USE_PRIVATE_LIBGCC +TARGETS	+= $(LIBGCC) +endif + +all:	$(TARGETS) +  $(LIB):	$(obj).depend $(OBJS)  	$(call cmd_link_o_target, $(OBJS)) +$(LIBGCC): $(obj).depend $(LGOBJS) +	$(call cmd_link_o_target, $(LGOBJS)) +  #########################################################################  # defines $(obj).depend target diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c new file mode 100644 index 000000000..9b50d866a --- /dev/null +++ b/arch/mips/lib/ashldi3.c @@ -0,0 +1,25 @@ +#include "libgcc.h" + +long long __ashldi3(long long u, word_type b) +{ +	DWunion uu, w; +	word_type bm; + +	if (b == 0) +		return u; + +	uu.ll = u; +	bm = 32 - b; + +	if (bm <= 0) { +		w.s.low = 0; +		w.s.high = (unsigned int) uu.s.low << -bm; +	} else { +		const unsigned int carries = (unsigned int) uu.s.low >> bm; + +		w.s.low = (unsigned int) uu.s.low << b; +		w.s.high = ((unsigned int) uu.s.high << b) | carries; +	} + +	return w.ll; +} diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c new file mode 100644 index 000000000..f30359b73 --- /dev/null +++ b/arch/mips/lib/ashrdi3.c @@ -0,0 +1,27 @@ +#include "libgcc.h" + +long long __ashrdi3(long long u, word_type b) +{ +	DWunion uu, w; +	word_type bm; + +	if (b == 0) +		return u; + +	uu.ll = u; +	bm = 32 - b; + +	if (bm <= 0) { +		/* w.s.high = 1..1 or 0..0 */ +		w.s.high = +		    uu.s.high >> 31; +		w.s.low = uu.s.high >> -bm; +	} else { +		const unsigned int carries = (unsigned int) uu.s.high << bm; + +		w.s.high = uu.s.high >> b; +		w.s.low = ((unsigned int) uu.s.low >> b) | carries; +	} + +	return w.ll; +} diff --git a/arch/mips/lib/libgcc.h b/arch/mips/lib/libgcc.h new file mode 100644 index 000000000..05909d58e --- /dev/null +++ b/arch/mips/lib/libgcc.h @@ -0,0 +1,25 @@ +#ifndef __ASM_LIBGCC_H +#define __ASM_LIBGCC_H + +#include <asm/byteorder.h> + +typedef int word_type __attribute__ ((mode (__word__))); + +#ifdef __BIG_ENDIAN +struct DWstruct { +	int high, low; +}; +#elif defined(__LITTLE_ENDIAN) +struct DWstruct { +	int low, high; +}; +#else +#error I feel sick. +#endif + +typedef union { +	struct DWstruct s; +	long long ll; +} DWunion; + +#endif /* __ASM_LIBGCC_H */ diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c new file mode 100644 index 000000000..bb340accb --- /dev/null +++ b/arch/mips/lib/lshrdi3.c @@ -0,0 +1,25 @@ +#include "libgcc.h" + +long long __lshrdi3(long long u, word_type b) +{ +	DWunion uu, w; +	word_type bm; + +	if (b == 0) +		return u; + +	uu.ll = u; +	bm = 32 - b; + +	if (bm <= 0) { +		w.s.high = 0; +		w.s.low = (unsigned int) uu.s.high >> -bm; +	} else { +		const unsigned int carries = (unsigned int) uu.s.high << bm; + +		w.s.high = (unsigned int) uu.s.high >> b; +		w.s.low = ((unsigned int) uu.s.low >> b) | carries; +	} + +	return w.ll; +} diff --git a/arch/powerpc/cpu/mpc5xxx/cpu_init.c b/arch/powerpc/cpu/mpc5xxx/cpu_init.c index 9daf3755a..3044b4171 100644 --- a/arch/powerpc/cpu/mpc5xxx/cpu_init.c +++ b/arch/powerpc/cpu/mpc5xxx/cpu_init.c @@ -169,6 +169,20 @@ void cpu_init_f (void)  	out_be32(&gpio->port_config, CONFIG_SYS_GPS_PORT_CONFIG);  #endif +	/* Setup gpios */ +#if defined(CONFIG_SYS_GPIO_DATADIR) +	out_be32(&gpio->simple_ddr, CONFIG_SYS_GPIO_DATADIR); +#endif +#if defined(CONFIG_SYS_GPIO_OPENDRAIN) +	out_be32(&gpio->simple_ode, CONFIG_SYS_GPIO_OPENDRAIN); +#endif +#if defined(CONFIG_SYS_GPIO_DATAVALUE) +	out_be32(&gpio->simple_dvo, CONFIG_SYS_GPIO_DATAVALUE); +#endif +#if defined(CONFIG_SYS_GPIO_ENABLE) +	out_be32(&gpio->simple_gpioe, CONFIG_SYS_GPIO_ENABLE); +#endif +  	/* enable timebase */  	setbits_be32(&xlb->config, (1 << 13)); diff --git a/arch/powerpc/include/asm/u-boot.h b/arch/powerpc/include/asm/u-boot.h index 155205411..b2fa2b574 100644 --- a/arch/powerpc/include/asm/u-boot.h +++ b/arch/powerpc/include/asm/u-boot.h @@ -63,6 +63,7 @@ typedef struct bd_info {  	unsigned long   bi_vcofreq;     /* VCO Freq, in MHz */  #endif  	unsigned long	bi_bootflags;	/* boot / reboot flag (Unused) */ +	unsigned long	bi_ip_addr;	/* IP Address */  	unsigned char	bi_enetaddr[6];	/* OLD: see README.enetaddr */  	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */  	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */ diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index cdd62a206..965f9ea4a 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -46,7 +46,6 @@ SOBJS-y	+= reloc.o  COBJS-$(CONFIG_BAT_RW) += bat_rw.o  COBJS-y	+= board.o  COBJS-y	+= bootm.o -COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o  COBJS-y	+= cache.o  COBJS-y	+= extable.o  COBJS-y	+= interrupts.o diff --git a/arch/powerpc/lib/bootcount.c b/arch/powerpc/lib/bootcount.c deleted file mode 100644 index f9ce539ec..000000000 --- a/arch/powerpc/lib/bootcount.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * (C) Copyright 2010 - * Stefan Roese, DENX Software Engineering, sr@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 <common.h> -#include <asm/io.h> - -/* - * Only override CONFIG_SYS_BOOTCOUNT_ADDR if not already defined. This - * way, some boards can define it directly in their config header. - */ -#if !defined(CONFIG_SYS_BOOTCOUNT_ADDR) - -#if defined(CONFIG_MPC5xxx) -#define CONFIG_SYS_BOOTCOUNT_ADDR	(MPC5XXX_CDM_BRDCRMB) -#define CONFIG_SYS_BOOTCOUNT_SINGLEWORD -#endif /* defined(CONFIG_MPC5xxx) */ - -#if defined(CONFIG_MPC512X) -#define CONFIG_SYS_BOOTCOUNT_ADDR	(&((immap_t *)CONFIG_SYS_IMMR)->clk.bcr) -#define CONFIG_SYS_BOOTCOUNT_SINGLEWORD -#endif /* defined(CONFIG_MPC512X) */ - -#if defined(CONFIG_8xx) -#define CONFIG_SYS_BOOTCOUNT_ADDR (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + \ -				CPM_BOOTCOUNT_ADDR) -#endif /* defined(CONFIG_8xx) */ - -#if defined(CONFIG_MPC8260) -#include <asm/cpm_8260.h> - -#define CONFIG_SYS_BOOTCOUNT_ADDR	(CONFIG_SYS_IMMR + CPM_BOOTCOUNT_ADDR) -#endif /* defined(CONFIG_MPC8260) */ - -#if defined(CONFIG_QE) -#include <asm/immap_qe.h> - -#define CONFIG_SYS_BOOTCOUNT_ADDR	(CONFIG_SYS_IMMR + 0x110000 + \ -					 QE_MURAM_SIZE - 2 * sizeof(u32)) -#endif /* defined(CONFIG_MPC8360) */ - -#if defined(CONFIG_4xx) -#define CONFIG_SYS_BOOTCOUNT_ADDR	(CONFIG_SYS_OCM_DATA_ADDR + \ -				CONFIG_SYS_BOOTCOUNT_ADDR) -#endif /* defined(CONFIG_4xx) */ - -#endif /* !defined(CONFIG_SYS_BOOTCOUNT_ADDR) */ - -void bootcount_store(ulong a) -{ -	void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR; - -#if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) -	out_be32(reg, (BOOTCOUNT_MAGIC & 0xffff0000) | a); -#else -	out_be32(reg, a); -	out_be32(reg + 4, BOOTCOUNT_MAGIC); -#endif -} - -ulong bootcount_load(void) -{ -	void *reg = (void *)CONFIG_SYS_BOOTCOUNT_ADDR; - -#if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) -	u32 tmp = in_be32(reg); - -	if ((tmp & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000)) -		return 0; -	else -		return (tmp & 0x0000ffff); -#else -	if (in_be32(reg + 4) != BOOTCOUNT_MAGIC) -		return 0; -	else -		return in_be32(reg); -#endif -} diff --git a/arch/powerpc/lib/ticks.S b/arch/powerpc/lib/ticks.S index b8d25b7f4..17810395b 100644 --- a/arch/powerpc/lib/ticks.S +++ b/arch/powerpc/lib/ticks.S @@ -47,7 +47,9 @@ get_ticks:   */  	.globl	wait_ticks  wait_ticks: -	mflr	r8		/* save link register */ +	stwu	r1, -16(r1) +	mflr	r0		/* save link register */ +	stw	r0, 20(r1)	/* Use r0 or GDB will be unhappy */  	mr	r7, r3		/* save tick count */  	bl	get_ticks	/* Get start time */ @@ -61,5 +63,6 @@ wait_ticks:  	subfe.	r3, r3, r6  	bge	1b		/* Loop until time expired */ -	mtlr	r8		/* restore link register */ +	mtlr	r0		/* restore link register */ +	addi	r1,r1,16  	blr diff --git a/arch/sh/include/asm/cpu_sh7706.h b/arch/sh/include/asm/cpu_sh7706.h index d093f88d4..8066ff719 100644 --- a/arch/sh/include/asm/cpu_sh7706.h +++ b/arch/sh/include/asm/cpu_sh7706.h @@ -41,10 +41,7 @@  #define SCIF0_BASE	SCSMR_2  /* Timer */ -#define TSTR0		0xFFFFFE92 -#define TSTR		TSTR0 -#define TCNT0		0xFFFFFE98 -#define TCR0		0xFFFFFE9C +#define TMU_BASE	0xFFFFFE90  /* On chip oscillator circuits */  #define	WTCNT	0xFFFFFF84 diff --git a/arch/sh/include/asm/cpu_sh7710.h b/arch/sh/include/asm/cpu_sh7710.h index e223f1ca1..e4ecef7f7 100644 --- a/arch/sh/include/asm/cpu_sh7710.h +++ b/arch/sh/include/asm/cpu_sh7710.h @@ -51,10 +51,7 @@  #define SCIF1_BASE	SCSMR_1  /* Timer */ -#define TSTR0		0xA412FE92 -#define TSTR		TSTR0 -#define TCNT0		0xa412FE98 -#define TCR0		0xa412FE9C +#define TMU_BASE	0xA412FE90  /* On chip oscillator circuits */  #define FRQCR		0xA415FF80 diff --git a/arch/sh/include/asm/cpu_sh7720.h b/arch/sh/include/asm/cpu_sh7720.h index 1b393b88a..a8013cc96 100644 --- a/arch/sh/include/asm/cpu_sh7720.h +++ b/arch/sh/include/asm/cpu_sh7720.h @@ -105,16 +105,6 @@  /*	TMU	*/  #define TMU_BASE	0xA412FE90 -#define TSTR		(TMU_BASE + 0x02) -#define TCOR0		(TMU_BASE + 0x04) -#define TCNT0		(TMU_BASE + 0x08) -#define TCR0		(TMU_BASE + 0x0C) -#define TCOR1		(TMU_BASE + 0x10) -#define TCNT1		(TMU_BASE + 0x14) -#define TCR1		(TMU_BASE + 0x18) -#define TCOR2		(TMU_BASE + 0x1C) -#define TCNT2		(TMU_BASE + 0x20) -#define TCR2		(TMU_BASE + 0x24)  /*	TPU	*/  #define TPU_BASE	0xA4480000 diff --git a/arch/sh/include/asm/cpu_sh7722.h b/arch/sh/include/asm/cpu_sh7722.h index 3157dcbf1..92dfe27cc 100644 --- a/arch/sh/include/asm/cpu_sh7722.h +++ b/arch/sh/include/asm/cpu_sh7722.h @@ -226,16 +226,7 @@  /*	TMU	*/ -#define TSTR        0xFFD80004 -#define TCOR0       0xFFD80008 -#define TCNT0       0xFFD8000C -#define TCR0        0xFFD80010 -#define TCOR1       0xFFD80014 -#define TCNT1       0xFFD80018 -#define TCR1        0xFFD8001C -#define TCOR2       0xFFD80020 -#define TCNT2       0xFFD80024 -#define TCR2        0xFFD80028 +#define TMU_BASE	0xFFD80000  /*	TPU	*/  #define TPU_TSTR    0xA4C90000 diff --git a/arch/sh/include/asm/cpu_sh7723.h b/arch/sh/include/asm/cpu_sh7723.h index 6dac6e9a0..2595f298d 100644 --- a/arch/sh/include/asm/cpu_sh7723.h +++ b/arch/sh/include/asm/cpu_sh7723.h @@ -95,16 +95,7 @@  #define WTCNT		RWTCNT  /* TMU */ -#define TSTR        0xFFD80004 -#define TCOR0       0xFFD80008 -#define TCNT0       0xFFD8000C -#define TCR0        0xFFD80010 -#define TCOR1       0xFFD80014 -#define TCNT1       0xFFD80018 -#define TCR1        0xFFD8001C -#define TCOR2       0xFFD80020 -#define TCNT2       0xFFD80024 -#define TCR2        0xFFD80028 +#define TMU_BASE	0xFFD80000  /* TPU */ diff --git a/arch/sh/include/asm/cpu_sh7724.h b/arch/sh/include/asm/cpu_sh7724.h index 3bb51d3f1..cd40b6d22 100644 --- a/arch/sh/include/asm/cpu_sh7724.h +++ b/arch/sh/include/asm/cpu_sh7724.h @@ -116,16 +116,7 @@  #define WTCNT		RWTCNT  /* TMU */ -#define TSTR        0xFFD80004 -#define TCOR0       0xFFD80008 -#define TCNT0       0xFFD8000C -#define TCR0        0xFFD80010 -#define TCOR1       0xFFD80014 -#define TCNT1       0xFFD80018 -#define TCR1        0xFFD8001C -#define TCOR2       0xFFD80020 -#define TCNT2       0xFFD80024 -#define TCR2        0xFFD80028 +#define TMU_BASE	0xFFD80000  /* TPU */ diff --git a/arch/sh/include/asm/cpu_sh7734.h b/arch/sh/include/asm/cpu_sh7734.h index 0f84b4f57..179a35751 100644 --- a/arch/sh/include/asm/cpu_sh7734.h +++ b/arch/sh/include/asm/cpu_sh7734.h @@ -36,9 +36,7 @@  #define SCIF5_BASE  0xFFE45000  /* Timer */ -#define TSTR	0xFFD80004 -#define TCNT0	0xFFD8000C -#define TCR0	0xFFD80010 +#define TMU_BASE 0xFFD80000  /* PFC */  #define PMMR    (0xFFFC0000) diff --git a/arch/sh/include/asm/cpu_sh7750.h b/arch/sh/include/asm/cpu_sh7750.h index b3e84244f..88c4c8d58 100644 --- a/arch/sh/include/asm/cpu_sh7750.h +++ b/arch/sh/include/asm/cpu_sh7750.h @@ -143,26 +143,7 @@  #define CLKSTPCLR	0xFE0A0008  /*      TMU     */ -#define TSTR2	0xFE100004 -#define TCOR3	0xFE100008 -#define TCNT3	0xFE10000C -#define TCR3	0xFE100010 -#define TCOR4	0xFE100014 -#define TCNT4	0xFE100018 -#define TCR4	0xFE10001C -#define TOCR	0xFFD80000 -#define TSTR0	0xFFD80004 -#define TCOR0	0xFFD80008 -#define TCNT0	0xFFD8000C -#define TCR0	0xFFD80010 -#define TCOR1	0xFFD80014 -#define TCNT1	0xFFD80018 -#define TCR1	0xFFD8001C -#define TCOR2	0xFFD80020 -#define TCNT2	0xFFD80024 -#define TCR2	0xFFD80028 -#define TCPR2	0xFFD8002C -#define TSTR	TSTR0 +#define TMU_BASE	0xFFD80000  /*      SCI     */  #define SCSMR1	0xFFE00000 diff --git a/arch/sh/include/asm/cpu_sh7757.h b/arch/sh/include/asm/cpu_sh7757.h index 17a6537bc..43c1f07b9 100644 --- a/arch/sh/include/asm/cpu_sh7757.h +++ b/arch/sh/include/asm/cpu_sh7757.h @@ -51,19 +51,7 @@ struct mmu_regs {  #define SMR0		0xfe470000  /* TMU0 */ -#define TSTR		0xFE430004 -#define TOCR		0xFE430000 -#define TSTR0		0xFE430004 -#define TCOR0		0xFE430008 -#define TCNT0		0xFE43000C -#define TCR0		0xFE430010 -#define TCOR1		0xFE430014 -#define TCNT1		0xFE430018 -#define TCR1		0xFE43001C -#define TCOR2		0xFE430020 -#define TCNT2		0xFE430024 -#define TCR2		0xFE430028 -#define TCPR2		0xFE43002C +#define TMU_BASE    0xFE430000  /* ETHER, GETHER MAC address */  struct ether_mac_regs { diff --git a/arch/sh/include/asm/cpu_sh7763.h b/arch/sh/include/asm/cpu_sh7763.h index 78b456b4b..36d70655c 100644 --- a/arch/sh/include/asm/cpu_sh7763.h +++ b/arch/sh/include/asm/cpu_sh7763.h @@ -43,9 +43,6 @@  #define WDTST		0xFFCC0000  /* TMU */ -#define TSTR		0xFFD80004 -#define TCOR0		0xFFD80008 -#define TCNT0		0xFFD8000C -#define TCR0		0xFFD80010 +#define TMU_BASE	0xFFD80000  #endif /* _ASM_CPU_SH7763_H_ */ diff --git a/arch/sh/include/asm/cpu_sh7780.h b/arch/sh/include/asm/cpu_sh7780.h index e9c59fe24..162aa688f 100644 --- a/arch/sh/include/asm/cpu_sh7780.h +++ b/arch/sh/include/asm/cpu_sh7780.h @@ -272,29 +272,7 @@  #define	MSTPCR	0xFFC80030  /* Timer Unit */ -#define	TSTR	TSTR0 -#define	TOCR	0xFFD80000 -#define	TSTR0	0xFFD80004 -#define	TCOR0	0xFFD80008 -#define	TCNT0	0xFFD8000C -#define	TCR0	0xFFD80010 -#define	TCOR1	0xFFD80014 -#define	TCNT1	0xFFD80018 -#define	TCR1	0xFFD8001C -#define	TCOR2	0xFFD80020 -#define	TCNT2	0xFFD80024 -#define	TCR2	0xFFD80028 -#define	TCPR2	0xFFD8002C -#define	TSTR1	0xFFDC0004 -#define	TCOR3	0xFFDC0008 -#define	TCNT3	0xFFDC000C -#define	TCR3	0xFFDC0010 -#define	TCOR4	0xFFDC0014 -#define	TCNT4	0xFFDC0018 -#define	TCR4	0xFFDC001C -#define	TCOR5	0xFFDC0020 -#define	TCNT5	0xFFDC0024 -#define	TCR5	0xFFDC0028 +#define TMU_BASE    0xFFD80000  /* Timer/Counter */  #define	CMTCFG	0xFFE30000 diff --git a/arch/sh/include/asm/cpu_sh7785.h b/arch/sh/include/asm/cpu_sh7785.h index 4a4dfc904..8e3839d1a 100644 --- a/arch/sh/include/asm/cpu_sh7785.h +++ b/arch/sh/include/asm/cpu_sh7785.h @@ -46,29 +46,7 @@  #define	WDTBCNT	0xFFCC0018  /* Timer Unit */ -#define	TSTR	TSTR0 -#define	TOCR	0xFFD80000 -#define	TSTR0	0xFFD80004 -#define	TCOR0	0xFFD80008 -#define	TCNT0	0xFFD8000C -#define	TCR0	0xFFD80010 -#define	TCOR1	0xFFD80014 -#define	TCNT1	0xFFD80018 -#define	TCR1	0xFFD8001C -#define	TCOR2	0xFFD80020 -#define	TCNT2	0xFFD80024 -#define	TCR2	0xFFD80028 -#define	TCPR2	0xFFD8002C -#define	TSTR1	0xFFDC0004 -#define	TCOR3	0xFFDC0008 -#define	TCNT3	0xFFDC000C -#define	TCR3	0xFFDC0010 -#define	TCOR4	0xFFDC0014 -#define	TCNT4	0xFFDC0018 -#define	TCR4	0xFFDC001C -#define	TCOR5	0xFFDC0020 -#define	TCNT5	0xFFDC0024 -#define	TCR5	0xFFDC0028 +#define TMU_BASE	0xFFD80000  /* Serial Communication	Interface with FIFO */  #define	SCIF1_BASE	0xffeb0000 diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index a01596cac..2cc61ddcb 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -2,7 +2,7 @@   * (C) Copyright 2009   * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>   * - * (C) Copyright 2007-2010 + * (C) Copyright 2007-2012   * Nobobuhiro Iwamatsu <iwamatsu@nigauri.org>   *   * (C) Copyright 2003 @@ -30,71 +30,54 @@  #include <common.h>  #include <div64.h>  #include <asm/processor.h> -#include <asm/clk.h>  #include <asm/io.h> +#include <sh_tmu.h> -#define TMU_MAX_COUNTER (~0UL) +static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; -static ulong timer_freq; +static u16 bit;  static unsigned long last_tcnt;  static unsigned long long overflow_ticks; +unsigned long get_tbclk(void) +{ +	return get_tmu0_clk_rate() >> ((bit + 1) * 2); +} +  static inline unsigned long long tick_to_time(unsigned long long tick)  {  	tick *= CONFIG_SYS_HZ; -	do_div(tick, timer_freq); +	do_div(tick, get_tbclk());  	return tick;  }  static inline unsigned long long usec_to_tick(unsigned long long usec)  { -	usec *= timer_freq; +	usec *= get_tbclk();  	do_div(usec, 1000000);  	return usec;  } -static void tmu_timer_start (unsigned int timer) +static void tmu_timer_start(unsigned int timer)  {  	if (timer > 2)  		return; -	writeb(readb(TSTR) | (1 << timer), TSTR); +	writeb(readb(&tmu->tstr) | (1 << timer), &tmu->tstr);  } -static void tmu_timer_stop (unsigned int timer) +static void tmu_timer_stop(unsigned int timer)  {  	if (timer > 2)  		return; -	writeb(readb(TSTR) & ~(1 << timer), TSTR); +	writeb(readb(&tmu->tstr) & ~(1 << timer), &tmu->tstr);  } -int timer_init (void) +int timer_init(void)  { -	/* Divide clock by CONFIG_SYS_TMU_CLK_DIV */ -	u16 bit = 0; - -	switch (CONFIG_SYS_TMU_CLK_DIV) { -	case 1024: -		bit = 4; -		break; -	case 256: -		bit = 3; -		break; -	case 64: -		bit = 2; -		break; -	case 16: -		bit = 1; -		break; -	case 4: -	default: -		break; -	} -	writew(readw(TCR0) | bit, TCR0); - -	/* Calc clock rate */ -	timer_freq = get_tmu0_clk_rate() >> ((bit + 1) * 2); +	bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1; +	writew(readw(&tmu->tcr0) | bit, &tmu->tcr0);  	tmu_timer_stop(0);  	tmu_timer_start(0); @@ -105,9 +88,9 @@ int timer_init (void)  	return 0;  } -unsigned long long get_ticks (void) +unsigned long long get_ticks(void)  { -	unsigned long tcnt = 0 - readl(TCNT0); +	unsigned long tcnt = 0 - readl(&tmu->tcnt0);  	if (last_tcnt > tcnt) /* overflow */  		overflow_ticks++; @@ -116,7 +99,7 @@ unsigned long long get_ticks (void)  	return (overflow_ticks << 32) | tcnt;  } -void __udelay (unsigned long usec) +void __udelay(unsigned long usec)  {  	unsigned long long tmp;  	ulong tmo; @@ -128,13 +111,20 @@ void __udelay (unsigned long usec)  		 /*NOP*/;  } -unsigned long get_timer (unsigned long base) +unsigned long get_timer(unsigned long base)  {  	/* return msec */  	return tick_to_time(get_ticks()) - base;  } -unsigned long get_tbclk (void) +void set_timer(unsigned long t)  { -	return timer_freq; +	writel((0 - t), &tmu->tcnt0); +} + +void reset_timer(void) +{ +	tmu_timer_stop(0); +	set_timer(0); +	tmu_timer_start(0);  } diff --git a/arch/sparc/cpu/leon2/interrupts.c b/arch/sparc/cpu/leon2/interrupts.c index 5149550e8..f707efd25 100644 --- a/arch/sparc/cpu/leon2/interrupts.c +++ b/arch/sparc/cpu/leon2/interrupts.c @@ -207,9 +207,9 @@ void do_irqinfo(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const a  	for (irq = 0; irq < NR_IRQS; irq++) {  		if (irq_handlers[irq].handler != NULL) { -			printf("%02d  %08lx  %08lx  %ld\n", irq, -			       (unsigned int)irq_handlers[irq].handler, -			       (unsigned int)irq_handlers[irq].arg, +			printf("%02d  %p  %p  %d\n", irq, +			       irq_handlers[irq].handler, +			       irq_handlers[irq].arg,  			       irq_handlers[irq].count);  		}  	} diff --git a/arch/sparc/cpu/leon3/interrupts.c b/arch/sparc/cpu/leon3/interrupts.c index 4138f9b67..4a3847de5 100644 --- a/arch/sparc/cpu/leon3/interrupts.c +++ b/arch/sparc/cpu/leon3/interrupts.c @@ -209,9 +209,9 @@ void do_irqinfo(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char * const a  	for (irq = 0; irq < NR_IRQS; irq++) {  		if (irq_handlers[irq].handler != NULL) { -			printf("%02d  %08lx  %08lx  %ld\n", irq, -			       (unsigned int)irq_handlers[irq].handler, -			       (unsigned int)irq_handlers[irq].arg, +			printf("%02d  %p  %p  %d\n", irq, +			       irq_handlers[irq].handler, +			       irq_handlers[irq].arg,  			       irq_handlers[irq].count);  		}  	} diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index 7e48775df..6f3366626 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -166,7 +166,6 @@ char *str_init_seq_done = "\n\rInit sequence done...\r\n\r\n";  void board_init_f(ulong bootflag)  {  	bd_t *bd; -	unsigned char *s;  	init_fnc_t **init_fnc_ptr;  	int j; |