Commit d193c1b6eb05041c94ad9aacd8c94189d1dbc5f8
Exists in
master
and in
57 other branches
Merge remote-tracking branch 'u-boot-imx/master'
Showing 51 changed files Side-by-side Diff
- Makefile
- arch/arm/cpu/arm1136/mx31/generic.c
- arch/arm/cpu/arm1136/mx31/timer.c
- arch/arm/cpu/arm1136/mx35/generic.c
- arch/arm/cpu/arm1136/mx35/timer.c
- arch/arm/cpu/arm926ejs/mx25/generic.c
- arch/arm/cpu/arm926ejs/mx25/timer.c
- arch/arm/cpu/arm926ejs/mxs/spl_boot.c
- arch/arm/cpu/armv7/imx-common/Makefile
- arch/arm/cpu/armv7/imx-common/cmd_bmode.c
- arch/arm/cpu/armv7/imx-common/cpu.c
- arch/arm/cpu/armv7/imx-common/i2c.c
- arch/arm/cpu/armv7/imx-common/iomux-v3.c
- arch/arm/cpu/armv7/imx-common/speed.c
- arch/arm/cpu/armv7/imx-common/timer.c
- arch/arm/imx-common/Makefile
- arch/arm/imx-common/cmd_bmode.c
- arch/arm/imx-common/cpu.c
- arch/arm/imx-common/i2c-mxv7.c
- arch/arm/imx-common/iomux-v3.c
- arch/arm/imx-common/speed.c
- arch/arm/imx-common/timer.c
- arch/arm/include/asm/arch-mx25/clock.h
- arch/arm/include/asm/arch-mx31/clock.h
- arch/arm/include/asm/arch-mx35/clock.h
- arch/arm/include/asm/arch-mx35/crm_regs.h
- arch/arm/include/asm/arch-mx6/iomux.h
- board/freescale/mx28evk/iomux.c
- board/freescale/mx28evk/mx28evk.c
- board/freescale/mx35pdk/README
- board/freescale/mx35pdk/mx35pdk.c
- board/freescale/mx6qsabrelite/mx6qsabrelite.c
- board/genesi/mx51_efikamx/Makefile
- board/genesi/mx51_efikamx/efikamx-usb.c
- board/genesi/mx51_efikamx/efikamx.c
- drivers/mmc/mxsmmc.c
- drivers/spi/mxs_spi.c
- include/configs/flea3.h
- include/configs/ima3-mx53.h
- include/configs/imx31_litekit.h
- include/configs/imx31_phycore.h
- include/configs/m28evk.h
- include/configs/mx25pdk.h
- include/configs/mx28evk.h
- include/configs/mx31ads.h
- include/configs/mx31pdk.h
- include/configs/mx35pdk.h
- include/configs/qong.h
- include/configs/sc_sps_1.h
- include/configs/tt01.h
- include/configs/zmx25.h
Makefile
| ... | ... | @@ -306,12 +306,9 @@ |
| 306 | 306 | LIBS-y += $(CPUDIR)/omap-common/libomap-common.o |
| 307 | 307 | endif |
| 308 | 308 | |
| 309 | -ifeq ($(SOC),mx5) | |
| 310 | -LIBS-y += $(CPUDIR)/imx-common/libimx-common.o | |
| 309 | +ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35)) | |
| 310 | +LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o | |
| 311 | 311 | endif |
| 312 | -ifeq ($(SOC),mx6) | |
| 313 | -LIBS-y += $(CPUDIR)/imx-common/libimx-common.o | |
| 314 | -endif | |
| 315 | 312 | |
| 316 | 313 | ifeq ($(SOC),s5pc1xx) |
| 317 | 314 | LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o |
| ... | ... | @@ -776,6 +773,7 @@ |
| 776 | 773 | $(obj)tools/gen_eth_addr $(obj)tools/img2srec \ |
| 777 | 774 | $(obj)tools/mk{env,}image $(obj)tools/mpc86x_clk \ |
| 778 | 775 | $(obj)tools/mk{smdk5250,}spl \ |
| 776 | + $(obj)tools/mxsboot \ | |
| 779 | 777 | $(obj)tools/ncb $(obj)tools/ubsha1 |
| 780 | 778 | @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \ |
| 781 | 779 | $(obj)board/matrix_vision/*/bootscript.img \ |
arch/arm/cpu/arm1136/mx31/generic.c
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | #include <common.h> |
| 25 | +#include <div64.h> | |
| 25 | 26 | #include <asm/arch/imx-regs.h> |
| 26 | 27 | #include <asm/arch/clock.h> |
| 27 | 28 | #include <asm/io.h> |
| 28 | 29 | |
| 29 | 30 | |
| ... | ... | @@ -30,16 +31,17 @@ |
| 30 | 31 | static u32 mx31_decode_pll(u32 reg, u32 infreq) |
| 31 | 32 | { |
| 32 | 33 | u32 mfi = GET_PLL_MFI(reg); |
| 33 | - u32 mfn = GET_PLL_MFN(reg); | |
| 34 | + s32 mfn = GET_PLL_MFN(reg); | |
| 34 | 35 | u32 mfd = GET_PLL_MFD(reg); |
| 35 | 36 | u32 pd = GET_PLL_PD(reg); |
| 36 | 37 | |
| 37 | 38 | mfi = mfi <= 5 ? 5 : mfi; |
| 39 | + mfn = mfn >= 512 ? mfn - 1024 : mfn; | |
| 38 | 40 | mfd += 1; |
| 39 | 41 | pd += 1; |
| 40 | 42 | |
| 41 | - return ((2 * (infreq >> 10) * (mfi * mfd + mfn)) / | |
| 42 | - (mfd * pd)) << 10; | |
| 43 | + return lldiv(2 * (u64)infreq * (mfi * mfd + mfn), | |
| 44 | + mfd * pd); | |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | static u32 mx31_get_mpl_dpdgck_clk(void) |
| 46 | 48 | |
| ... | ... | @@ -47,9 +49,9 @@ |
| 47 | 49 | u32 infreq; |
| 48 | 50 | |
| 49 | 51 | if ((readl(CCM_CCMR) & CCMR_PRCS_MASK) == CCMR_FPM) |
| 50 | - infreq = CONFIG_MX31_CLK32 * 1024; | |
| 52 | + infreq = MXC_CLK32 * 1024; | |
| 51 | 53 | else |
| 52 | - infreq = CONFIG_MX31_HCLK_FREQ; | |
| 54 | + infreq = MXC_HCLK; | |
| 53 | 55 | |
| 54 | 56 | return mx31_decode_pll(readl(CCM_MPCTL), infreq); |
| 55 | 57 | } |
arch/arm/cpu/arm1136/mx31/timer.c
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | |
| 24 | 24 | #include <common.h> |
| 25 | 25 | #include <asm/arch/imx-regs.h> |
| 26 | +#include <asm/arch/clock.h> | |
| 26 | 27 | #include <div64.h> |
| 27 | 28 | #include <watchdog.h> |
| 28 | 29 | #include <asm/io.h> |
| 29 | 30 | |
| 30 | 31 | |
| 31 | 32 | |
| ... | ... | @@ -53,28 +54,27 @@ |
| 53 | 54 | static inline unsigned long long tick_to_time(unsigned long long tick) |
| 54 | 55 | { |
| 55 | 56 | tick *= CONFIG_SYS_HZ; |
| 56 | - do_div(tick, CONFIG_MX31_CLK32); | |
| 57 | + do_div(tick, MXC_CLK32); | |
| 57 | 58 | return tick; |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | 61 | static inline unsigned long long time_to_tick(unsigned long long time) |
| 61 | 62 | { |
| 62 | - time *= CONFIG_MX31_CLK32; | |
| 63 | + time *= MXC_CLK32; | |
| 63 | 64 | do_div(time, CONFIG_SYS_HZ); |
| 64 | 65 | return time; |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | static inline unsigned long long us_to_tick(unsigned long long us) |
| 68 | 69 | { |
| 69 | - us = us * CONFIG_MX31_CLK32 + 999999; | |
| 70 | + us = us * MXC_CLK32 + 999999; | |
| 70 | 71 | do_div(us, 1000000); |
| 71 | 72 | return us; |
| 72 | 73 | } |
| 73 | 74 | #else |
| 74 | 75 | /* ~2% error */ |
| 75 | -#define TICK_PER_TIME ((CONFIG_MX31_CLK32 + CONFIG_SYS_HZ / 2) \ | |
| 76 | - / CONFIG_SYS_HZ) | |
| 77 | -#define US_PER_TICK (1000000 / CONFIG_MX31_CLK32) | |
| 76 | +#define TICK_PER_TIME ((MXC_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) | |
| 77 | +#define US_PER_TICK (1000000 / MXC_CLK32) | |
| 78 | 78 | |
| 79 | 79 | static inline unsigned long long tick_to_time(unsigned long long tick) |
| 80 | 80 | { |
| ... | ... | @@ -128,7 +128,7 @@ |
| 128 | 128 | { |
| 129 | 129 | /* |
| 130 | 130 | * get_ticks() returns a long long (64 bit), it wraps in |
| 131 | - * 2^64 / CONFIG_MX31_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 131 | + * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 132 | 132 | * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in |
| 133 | 133 | * 5 * 10^6 days - long enough. |
| 134 | 134 | */ |
| ... | ... | @@ -159,7 +159,7 @@ |
| 159 | 159 | */ |
| 160 | 160 | ulong get_tbclk(void) |
| 161 | 161 | { |
| 162 | - return CONFIG_MX31_CLK32; | |
| 162 | + return MXC_CLK32; | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | void reset_cpu(ulong addr) |
arch/arm/cpu/arm1136/mx35/generic.c
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | #include <common.h> |
| 27 | +#include <div64.h> | |
| 27 | 28 | #include <asm/io.h> |
| 28 | 29 | #include <asm/errno.h> |
| 29 | 30 | #include <asm/arch/imx-regs.h> |
| 30 | 31 | |
| 31 | 32 | |
| ... | ... | @@ -129,15 +130,17 @@ |
| 129 | 130 | static u32 decode_pll(u32 reg, u32 infreq) |
| 130 | 131 | { |
| 131 | 132 | u32 mfi = (reg >> 10) & 0xf; |
| 132 | - u32 mfn = reg & 0x3f; | |
| 133 | - u32 mfd = (reg >> 16) & 0x3f; | |
| 133 | + s32 mfn = reg & 0x3ff; | |
| 134 | + u32 mfd = (reg >> 16) & 0x3ff; | |
| 134 | 135 | u32 pd = (reg >> 26) & 0xf; |
| 135 | 136 | |
| 136 | 137 | mfi = mfi <= 5 ? 5 : mfi; |
| 138 | + mfn = mfn >= 512 ? mfn - 1024 : mfn; | |
| 137 | 139 | mfd += 1; |
| 138 | 140 | pd += 1; |
| 139 | 141 | |
| 140 | - return ((2 * (infreq / 1000) * (mfi * mfd + mfn)) / (mfd * pd)) * 1000; | |
| 142 | + return lldiv(2 * (u64)infreq * (mfi * mfd + mfn), | |
| 143 | + mfd * pd); | |
| 141 | 144 | } |
| 142 | 145 | |
| 143 | 146 | static u32 get_mcu_main_clk(void) |
| ... | ... | @@ -146,9 +149,7 @@ |
| 146 | 149 | struct ccm_regs *ccm = |
| 147 | 150 | (struct ccm_regs *)IMX_CCM_BASE; |
| 148 | 151 | arm_div = get_arm_div(readl(&ccm->pdr0), &fi, &fd); |
| 149 | - fi *= | |
| 150 | - decode_pll(readl(&ccm->mpctl), | |
| 151 | - CONFIG_MX35_HCLK_FREQ); | |
| 152 | + fi *= decode_pll(readl(&ccm->mpctl), MXC_HCLK); | |
| 152 | 153 | return fi / (arm_div * fd); |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | |
| 156 | 157 | |
| ... | ... | @@ -171,17 +172,14 @@ |
| 171 | 172 | u32 pdr4 = readl(&ccm->pdr4); |
| 172 | 173 | u32 div; |
| 173 | 174 | if (pdr0 & MXC_CCM_PDR0_PER_SEL) { |
| 174 | - div = (CCM_GET_DIVIDER(pdr4, | |
| 175 | - MXC_CCM_PDR4_PER0_PRDF_MASK, | |
| 176 | - MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1) * | |
| 177 | - (CCM_GET_DIVIDER(pdr4, | |
| 175 | + div = CCM_GET_DIVIDER(pdr4, | |
| 178 | 176 | MXC_CCM_PDR4_PER0_PODF_MASK, |
| 179 | - MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1); | |
| 177 | + MXC_CCM_PDR4_PER0_PODF_OFFSET) + 1; | |
| 180 | 178 | } else { |
| 181 | 179 | div = CCM_GET_DIVIDER(pdr0, |
| 182 | 180 | MXC_CCM_PDR0_PER_PODF_MASK, |
| 183 | 181 | MXC_CCM_PDR0_PER_PODF_OFFSET) + 1; |
| 184 | - freq /= get_ahb_div(pdr0); | |
| 182 | + div *= get_ahb_div(pdr0); | |
| 185 | 183 | } |
| 186 | 184 | return freq / div; |
| 187 | 185 | } |
| 188 | 186 | |
| 189 | 187 | |
| 190 | 188 | |
| ... | ... | @@ -193,25 +191,20 @@ |
| 193 | 191 | (struct ccm_regs *)IMX_CCM_BASE; |
| 194 | 192 | u32 pdr4 = readl(&ccm->pdr4); |
| 195 | 193 | |
| 196 | - if (readl(&ccm->pdr3) & MXC_CCM_PDR3_UART_M_U) { | |
| 194 | + if (readl(&ccm->pdr3) & MXC_CCM_PDR3_UART_M_U) | |
| 197 | 195 | freq = get_mcu_main_clk(); |
| 198 | - } else { | |
| 199 | - freq = decode_pll(readl(&ccm->ppctl), | |
| 200 | - CONFIG_MX35_HCLK_FREQ); | |
| 201 | - } | |
| 202 | - freq /= ((CCM_GET_DIVIDER(pdr4, | |
| 203 | - MXC_CCM_PDR4_UART_PRDF_MASK, | |
| 204 | - MXC_CCM_PDR4_UART_PRDF_OFFSET) + 1) * | |
| 205 | - (CCM_GET_DIVIDER(pdr4, | |
| 196 | + else | |
| 197 | + freq = decode_pll(readl(&ccm->ppctl), MXC_HCLK); | |
| 198 | + freq /= CCM_GET_DIVIDER(pdr4, | |
| 206 | 199 | MXC_CCM_PDR4_UART_PODF_MASK, |
| 207 | - MXC_CCM_PDR4_UART_PODF_OFFSET) + 1)); | |
| 200 | + MXC_CCM_PDR4_UART_PODF_OFFSET) + 1; | |
| 208 | 201 | return freq; |
| 209 | 202 | } |
| 210 | 203 | |
| 211 | 204 | unsigned int mxc_get_main_clock(enum mxc_main_clock clk) |
| 212 | 205 | { |
| 213 | 206 | u32 nfc_pdf, hsp_podf; |
| 214 | - u32 pll, ret_val = 0, usb_prdf, usb_podf; | |
| 207 | + u32 pll, ret_val = 0, usb_podf; | |
| 215 | 208 | struct ccm_regs *ccm = |
| 216 | 209 | (struct ccm_regs *)IMX_CCM_BASE; |
| 217 | 210 | |
| 218 | 211 | |
| 219 | 212 | |
| ... | ... | @@ -255,16 +248,13 @@ |
| 255 | 248 | ret_val = pll / (nfc_pdf + 1); |
| 256 | 249 | break; |
| 257 | 250 | case USB_CLK: |
| 258 | - usb_prdf = (reg4 >> 25) & 0x7; | |
| 259 | - usb_podf = (reg4 >> 22) & 0x7; | |
| 260 | - if (reg4 & 0x200) { | |
| 251 | + usb_podf = (reg4 >> 22) & 0x3F; | |
| 252 | + if (reg4 & 0x200) | |
| 261 | 253 | pll = get_mcu_main_clk(); |
| 262 | - } else { | |
| 263 | - pll = decode_pll(readl(&ccm->ppctl), | |
| 264 | - CONFIG_MX35_HCLK_FREQ); | |
| 265 | - } | |
| 254 | + else | |
| 255 | + pll = decode_pll(readl(&ccm->ppctl), MXC_HCLK); | |
| 266 | 256 | |
| 267 | - ret_val = pll / ((usb_prdf + 1) * (usb_podf + 1)); | |
| 257 | + ret_val = pll / (usb_podf + 1); | |
| 268 | 258 | break; |
| 269 | 259 | default: |
| 270 | 260 | printf("Unknown clock: %d\n", clk); |
| 271 | 261 | |
| 272 | 262 | |
| ... | ... | @@ -287,18 +277,16 @@ |
| 287 | 277 | case UART2_BAUD: |
| 288 | 278 | case UART3_BAUD: |
| 289 | 279 | clk_sel = mpdr3 & (1 << 14); |
| 290 | - pre_pdf = (mpdr4 >> 13) & 0x7; | |
| 291 | - pdf = (mpdr4 >> 10) & 0x7; | |
| 280 | + pdf = (mpdr4 >> 10) & 0x3F; | |
| 292 | 281 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 293 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 294 | - ((pre_pdf + 1) * (pdf + 1)); | |
| 282 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1); | |
| 295 | 283 | break; |
| 296 | 284 | case SSI1_BAUD: |
| 297 | 285 | pre_pdf = (mpdr2 >> 24) & 0x7; |
| 298 | 286 | pdf = mpdr2 & 0x3F; |
| 299 | 287 | clk_sel = mpdr2 & (1 << 6); |
| 300 | 288 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 301 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 289 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / | |
| 302 | 290 | ((pre_pdf + 1) * (pdf + 1)); |
| 303 | 291 | break; |
| 304 | 292 | case SSI2_BAUD: |
| 305 | 293 | |
| 306 | 294 | |
| ... | ... | @@ -306,16 +294,14 @@ |
| 306 | 294 | pdf = (mpdr2 >> 8) & 0x3F; |
| 307 | 295 | clk_sel = mpdr2 & (1 << 6); |
| 308 | 296 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 309 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 297 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / | |
| 310 | 298 | ((pre_pdf + 1) * (pdf + 1)); |
| 311 | 299 | break; |
| 312 | 300 | case CSI_BAUD: |
| 313 | 301 | clk_sel = mpdr2 & (1 << 7); |
| 314 | - pre_pdf = (mpdr2 >> 16) & 0x7; | |
| 315 | - pdf = (mpdr2 >> 19) & 0x7; | |
| 302 | + pdf = (mpdr2 >> 16) & 0x3F; | |
| 316 | 303 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 317 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 318 | - ((pre_pdf + 1) * (pdf + 1)); | |
| 304 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1); | |
| 319 | 305 | break; |
| 320 | 306 | case MSHC_CLK: |
| 321 | 307 | pre_pdf = readl(&ccm->pdr1); |
| 322 | 308 | |
| 323 | 309 | |
| 324 | 310 | |
| 325 | 311 | |
| 326 | 312 | |
| 327 | 313 | |
| 328 | 314 | |
| ... | ... | @@ -323,39 +309,33 @@ |
| 323 | 309 | pdf = (pre_pdf >> 22) & 0x3F; |
| 324 | 310 | pre_pdf = (pre_pdf >> 28) & 0x7; |
| 325 | 311 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 326 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 312 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / | |
| 327 | 313 | ((pre_pdf + 1) * (pdf + 1)); |
| 328 | 314 | break; |
| 329 | 315 | case ESDHC1_CLK: |
| 330 | 316 | clk_sel = mpdr3 & 0x40; |
| 331 | - pre_pdf = mpdr3 & 0x7; | |
| 332 | - pdf = (mpdr3>>3) & 0x7; | |
| 317 | + pdf = mpdr3 & 0x3F; | |
| 333 | 318 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 334 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 335 | - ((pre_pdf + 1) * (pdf + 1)); | |
| 319 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1); | |
| 336 | 320 | break; |
| 337 | 321 | case ESDHC2_CLK: |
| 338 | 322 | clk_sel = mpdr3 & 0x40; |
| 339 | - pre_pdf = (mpdr3 >> 8) & 0x7; | |
| 340 | - pdf = (mpdr3 >> 11) & 0x7; | |
| 323 | + pdf = (mpdr3 >> 8) & 0x3F; | |
| 341 | 324 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 342 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 343 | - ((pre_pdf + 1) * (pdf + 1)); | |
| 325 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1); | |
| 344 | 326 | break; |
| 345 | 327 | case ESDHC3_CLK: |
| 346 | 328 | clk_sel = mpdr3 & 0x40; |
| 347 | - pre_pdf = (mpdr3 >> 16) & 0x7; | |
| 348 | - pdf = (mpdr3 >> 19) & 0x7; | |
| 329 | + pdf = (mpdr3 >> 16) & 0x3F; | |
| 349 | 330 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 350 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 351 | - ((pre_pdf + 1) * (pdf + 1)); | |
| 331 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / (pdf + 1); | |
| 352 | 332 | break; |
| 353 | 333 | case SPDIF_CLK: |
| 354 | 334 | clk_sel = mpdr3 & 0x400000; |
| 355 | 335 | pre_pdf = (mpdr3 >> 29) & 0x7; |
| 356 | 336 | pdf = (mpdr3 >> 23) & 0x3F; |
| 357 | 337 | ret_val = ((clk_sel != 0) ? mxc_get_main_clock(CPU_CLK) : |
| 358 | - decode_pll(readl(&ccm->ppctl), CONFIG_MX35_HCLK_FREQ)) / | |
| 338 | + decode_pll(readl(&ccm->ppctl), MXC_HCLK)) / | |
| 359 | 339 | ((pre_pdf + 1) * (pdf + 1)); |
| 360 | 340 | break; |
| 361 | 341 | default: |
arch/arm/cpu/arm1136/mx35/timer.c
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | #include <asm/io.h> |
| 28 | 28 | #include <div64.h> |
| 29 | 29 | #include <asm/arch/imx-regs.h> |
| 30 | +#include <asm/arch/crm_regs.h> | |
| 30 | 31 | #include <asm/arch/clock.h> |
| 31 | 32 | |
| 32 | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | 34 | |
| 34 | 35 | |
| 35 | 36 | |
| 36 | 37 | |
| 37 | 38 | |
| 38 | 39 | |
| 39 | 40 | |
| 40 | 41 | |
| 41 | 42 | |
| 42 | 43 | |
| ... | ... | @@ -37,44 +38,53 @@ |
| 37 | 38 | /* General purpose timers bitfields */ |
| 38 | 39 | #define GPTCR_SWR (1<<15) /* Software reset */ |
| 39 | 40 | #define GPTCR_FRR (1<<9) /* Freerun / restart */ |
| 40 | -#define GPTCR_CLKSOURCE_32 (0x100<<6) /* Clock source */ | |
| 41 | -#define GPTCR_CLKSOURCE_IPG (0x001<<6) /* Clock source */ | |
| 41 | +#define GPTCR_CLKSOURCE_32 (4<<6) /* Clock source */ | |
| 42 | 42 | #define GPTCR_TEN (1) /* Timer enable */ |
| 43 | 43 | |
| 44 | -#define TIMER_FREQ_HZ mxc_get_clock(MXC_IPG_CLK) | |
| 45 | - | |
| 44 | +/* | |
| 45 | + * "time" is measured in 1 / CONFIG_SYS_HZ seconds, | |
| 46 | + * "tick" is internal timer period | |
| 47 | + */ | |
| 48 | +/* ~0.4% error - measured with stop-watch on 100s boot-delay */ | |
| 46 | 49 | static inline unsigned long long tick_to_time(unsigned long long tick) |
| 47 | 50 | { |
| 48 | 51 | tick *= CONFIG_SYS_HZ; |
| 49 | - do_div(tick, TIMER_FREQ_HZ); | |
| 52 | + do_div(tick, MXC_CLK32); | |
| 50 | 53 | |
| 51 | 54 | return tick; |
| 52 | 55 | } |
| 53 | 56 | |
| 54 | -static inline unsigned long long us_to_tick(unsigned long long usec) | |
| 57 | +static inline unsigned long long us_to_tick(unsigned long long us) | |
| 55 | 58 | { |
| 56 | - usec *= TIMER_FREQ_HZ; | |
| 57 | - do_div(usec, 1000000); | |
| 59 | + us = us * MXC_CLK32 + 999999; | |
| 60 | + do_div(us, 1000000); | |
| 58 | 61 | |
| 59 | - return usec; | |
| 62 | + return us; | |
| 60 | 63 | } |
| 61 | 64 | |
| 65 | +/* | |
| 66 | + * nothing really to do with interrupts, just starts up a counter. | |
| 67 | + * The 32KHz 32-bit timer overruns in 134217 seconds | |
| 68 | + */ | |
| 62 | 69 | int timer_init(void) |
| 63 | 70 | { |
| 64 | 71 | int i; |
| 65 | 72 | struct gpt_regs *gpt = (struct gpt_regs *)GPT1_BASE_ADDR; |
| 73 | + struct ccm_regs *ccm = (struct ccm_regs *)CCM_BASE_ADDR; | |
| 66 | 74 | |
| 67 | 75 | /* setup GP Timer 1 */ |
| 68 | 76 | writel(GPTCR_SWR, &gpt->ctrl); |
| 69 | - for (i = 0; i < 100; i++) | |
| 70 | - writel(0, &gpt->ctrl); /* We have no udelay by now */ | |
| 71 | 77 | |
| 72 | - writel(0, &gpt->pre); | |
| 73 | - /* Freerun Mode, PERCLK1 input */ | |
| 74 | - writel(readl(&gpt->ctrl) | | |
| 75 | - GPTCR_CLKSOURCE_IPG | GPTCR_TEN, | |
| 76 | - &gpt->ctrl); | |
| 78 | + writel(readl(&ccm->cgr1) | 3 << MXC_CCM_CGR1_GPT_OFFSET, &ccm->cgr1); | |
| 77 | 79 | |
| 80 | + for (i = 0; i < 100; i++) | |
| 81 | + writel(0, &gpt->ctrl); /* We have no udelay by now */ | |
| 82 | + writel(0, &gpt->pre); /* prescaler = 1 */ | |
| 83 | + /* Freerun Mode, 32KHz input */ | |
| 84 | + writel(readl(&gpt->ctrl) | GPTCR_CLKSOURCE_32 | GPTCR_FRR, | |
| 85 | + &gpt->ctrl); | |
| 86 | + writel(readl(&gpt->ctrl) | GPTCR_TEN, &gpt->ctrl); | |
| 87 | + | |
| 78 | 88 | return 0; |
| 79 | 89 | } |
| 80 | 90 | |
| ... | ... | @@ -101,7 +111,7 @@ |
| 101 | 111 | { |
| 102 | 112 | /* |
| 103 | 113 | * get_ticks() returns a long long (64 bit), it wraps in |
| 104 | - * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 114 | + * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 105 | 115 | * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in |
| 106 | 116 | * 5 * 10^6 days - long enough. |
| 107 | 117 | */ |
| ... | ... | @@ -132,6 +142,6 @@ |
| 132 | 142 | */ |
| 133 | 143 | ulong get_tbclk(void) |
| 134 | 144 | { |
| 135 | - return TIMER_FREQ_HZ; | |
| 145 | + return MXC_CLK32; | |
| 136 | 146 | } |
arch/arm/cpu/arm926ejs/mx25/generic.c
arch/arm/cpu/arm926ejs/mx25/timer.c
| ... | ... | @@ -40,6 +40,7 @@ |
| 40 | 40 | #include <div64.h> |
| 41 | 41 | #include <asm/io.h> |
| 42 | 42 | #include <asm/arch/imx-regs.h> |
| 43 | +#include <asm/arch/clock.h> | |
| 43 | 44 | |
| 44 | 45 | DECLARE_GLOBAL_DATA_PTR; |
| 45 | 46 | |
| 46 | 47 | |
| 47 | 48 | |
| 48 | 49 | |
| ... | ... | @@ -55,28 +56,27 @@ |
| 55 | 56 | static inline unsigned long long tick_to_time(unsigned long long tick) |
| 56 | 57 | { |
| 57 | 58 | tick *= CONFIG_SYS_HZ; |
| 58 | - do_div(tick, CONFIG_MX25_CLK32); | |
| 59 | + do_div(tick, MXC_CLK32); | |
| 59 | 60 | return tick; |
| 60 | 61 | } |
| 61 | 62 | |
| 62 | 63 | static inline unsigned long long time_to_tick(unsigned long long time) |
| 63 | 64 | { |
| 64 | - time *= CONFIG_MX25_CLK32; | |
| 65 | + time *= MXC_CLK32; | |
| 65 | 66 | do_div(time, CONFIG_SYS_HZ); |
| 66 | 67 | return time; |
| 67 | 68 | } |
| 68 | 69 | |
| 69 | 70 | static inline unsigned long long us_to_tick(unsigned long long us) |
| 70 | 71 | { |
| 71 | - us = us * CONFIG_MX25_CLK32 + 999999; | |
| 72 | + us = us * MXC_CLK32 + 999999; | |
| 72 | 73 | do_div(us, 1000000); |
| 73 | 74 | return us; |
| 74 | 75 | } |
| 75 | 76 | #else |
| 76 | 77 | /* ~2% error */ |
| 77 | -#define TICK_PER_TIME ((CONFIG_MX25_CLK32 + CONFIG_SYS_HZ / 2) / \ | |
| 78 | - CONFIG_SYS_HZ) | |
| 79 | -#define US_PER_TICK (1000000 / CONFIG_MX25_CLK32) | |
| 78 | +#define TICK_PER_TIME ((MXC_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ) | |
| 79 | +#define US_PER_TICK (1000000 / MXC_CLK32) | |
| 80 | 80 | |
| 81 | 81 | static inline unsigned long long tick_to_time(unsigned long long tick) |
| 82 | 82 | { |
| ... | ... | @@ -144,7 +144,7 @@ |
| 144 | 144 | { |
| 145 | 145 | /* |
| 146 | 146 | * get_ticks() returns a long long (64 bit), it wraps in |
| 147 | - * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 147 | + * 2^64 / MXC_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 148 | 148 | * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in |
| 149 | 149 | * 5 * 10^6 days - long enough. |
| 150 | 150 | */ |
| ... | ... | @@ -177,7 +177,7 @@ |
| 177 | 177 | { |
| 178 | 178 | ulong tbclk; |
| 179 | 179 | |
| 180 | - tbclk = CONFIG_MX25_CLK32; | |
| 180 | + tbclk = MXC_CLK32; | |
| 181 | 181 | return tbclk; |
| 182 | 182 | } |
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
| ... | ... | @@ -38,12 +38,14 @@ |
| 38 | 38 | * takes a few seconds to roll. The boot doesn't take that long, so to keep the |
| 39 | 39 | * code simple, it doesn't take rolling into consideration. |
| 40 | 40 | */ |
| 41 | -#define HW_DIGCTRL_MICROSECONDS 0x8001c0c0 | |
| 42 | 41 | void early_delay(int delay) |
| 43 | 42 | { |
| 44 | - uint32_t st = readl(HW_DIGCTRL_MICROSECONDS); | |
| 43 | + struct mxs_digctl_regs *digctl_regs = | |
| 44 | + (struct mxs_digctl_regs *)MXS_DIGCTL_BASE; | |
| 45 | + | |
| 46 | + uint32_t st = readl(&digctl_regs->hw_digctl_microseconds); | |
| 45 | 47 | st += delay; |
| 46 | - while (st > readl(HW_DIGCTRL_MICROSECONDS)) | |
| 48 | + while (st > readl(&digctl_regs->hw_digctl_microseconds)) | |
| 47 | 49 | ; |
| 48 | 50 | } |
| 49 | 51 |
arch/arm/cpu/armv7/imx-common/Makefile
| 1 | -# | |
| 2 | -# (C) Copyright 2000-2006 | |
| 3 | -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
| 4 | -# | |
| 5 | -# (C) Copyright 2011 Freescale Semiconductor, Inc. | |
| 6 | -# | |
| 7 | -# See file CREDITS for list of people who contributed to this | |
| 8 | -# project. | |
| 9 | -# | |
| 10 | -# This program is free software; you can redistribute it and/or | |
| 11 | -# modify it under the terms of the GNU General Public License as | |
| 12 | -# published by the Free Software Foundation; either version 2 of | |
| 13 | -# the License, or (at your option) any later version. | |
| 14 | -# | |
| 15 | -# This program is distributed in the hope that it will be useful, | |
| 16 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | -# GNU General Public License for more details. | |
| 19 | -# | |
| 20 | -# You should have received a copy of the GNU General Public License | |
| 21 | -# along with this program; if not, write to the Free Software | |
| 22 | -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | -# MA 02111-1307 USA | |
| 24 | -# | |
| 25 | - | |
| 26 | -include $(TOPDIR)/config.mk | |
| 27 | - | |
| 28 | -LIB = $(obj)libimx-common.o | |
| 29 | - | |
| 30 | -COBJS-y = iomux-v3.o timer.o cpu.o speed.o | |
| 31 | -COBJS-$(CONFIG_I2C_MXC) += i2c.o | |
| 32 | -COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o | |
| 33 | -COBJS := $(sort $(COBJS-y)) | |
| 34 | - | |
| 35 | -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | |
| 36 | -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) | |
| 37 | - | |
| 38 | -all: $(obj).depend $(LIB) | |
| 39 | - | |
| 40 | -$(LIB): $(OBJS) | |
| 41 | - $(call cmd_link_o_target, $(OBJS)) | |
| 42 | - | |
| 43 | -######################################################################### | |
| 44 | - | |
| 45 | -# defines $(obj).depend target | |
| 46 | -include $(SRCTREE)/rules.mk | |
| 47 | - | |
| 48 | -sinclude $(obj).depend | |
| 49 | - | |
| 50 | -######################################################################### |
arch/arm/cpu/armv7/imx-common/cmd_bmode.c
| 1 | -/* | |
| 2 | - * Copyright (C) 2012 Boundary Devices Inc. | |
| 3 | - * | |
| 4 | - * See file CREDITS for list of people who contributed to this | |
| 5 | - * project. | |
| 6 | - * | |
| 7 | - * This program is free software; you can redistribute it and/or | |
| 8 | - * modify it under the terms of the GNU General Public License as | |
| 9 | - * published by the Free Software Foundation; either version 2 of | |
| 10 | - * the License, or (at your option) any later version. | |
| 11 | - * | |
| 12 | - * This program is distributed in the hope that it will be useful, | |
| 13 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | - * GNU General Public License for more details. | |
| 16 | - * | |
| 17 | - * You should have received a copy of the GNU General Public License | |
| 18 | - * along with this program; if not, write to the Free Software | |
| 19 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 20 | - * MA 02111-1307 USA | |
| 21 | - */ | |
| 22 | -#include <common.h> | |
| 23 | -#include <asm/errno.h> | |
| 24 | -#include <asm/io.h> | |
| 25 | -#include <asm/imx-common/boot_mode.h> | |
| 26 | -#include <malloc.h> | |
| 27 | - | |
| 28 | -static const struct boot_mode *modes[2]; | |
| 29 | - | |
| 30 | -static const struct boot_mode *search_modes(char *arg) | |
| 31 | -{ | |
| 32 | - int i; | |
| 33 | - | |
| 34 | - for (i = 0; i < ARRAY_SIZE(modes); i++) { | |
| 35 | - const struct boot_mode *p = modes[i]; | |
| 36 | - if (p) { | |
| 37 | - while (p->name) { | |
| 38 | - if (!strcmp(p->name, arg)) | |
| 39 | - return p; | |
| 40 | - p++; | |
| 41 | - } | |
| 42 | - } | |
| 43 | - } | |
| 44 | - return NULL; | |
| 45 | -} | |
| 46 | - | |
| 47 | -static int create_usage(char *dest) | |
| 48 | -{ | |
| 49 | - int i; | |
| 50 | - int size = 0; | |
| 51 | - | |
| 52 | - for (i = 0; i < ARRAY_SIZE(modes); i++) { | |
| 53 | - const struct boot_mode *p = modes[i]; | |
| 54 | - if (p) { | |
| 55 | - while (p->name) { | |
| 56 | - int len = strlen(p->name); | |
| 57 | - if (dest) { | |
| 58 | - memcpy(dest, p->name, len); | |
| 59 | - dest += len; | |
| 60 | - *dest++ = '|'; | |
| 61 | - } | |
| 62 | - size += len + 1; | |
| 63 | - p++; | |
| 64 | - } | |
| 65 | - } | |
| 66 | - } | |
| 67 | - if (dest) | |
| 68 | - memcpy(dest - 1, " [noreset]", 11); /* include trailing 0 */ | |
| 69 | - size += 10; | |
| 70 | - return size; | |
| 71 | -} | |
| 72 | - | |
| 73 | -static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc, | |
| 74 | - char * const argv[]) | |
| 75 | -{ | |
| 76 | - const struct boot_mode *p; | |
| 77 | - int reset_requested = 1; | |
| 78 | - | |
| 79 | - if (argc < 2) | |
| 80 | - return CMD_RET_USAGE; | |
| 81 | - p = search_modes(argv[1]); | |
| 82 | - if (!p) | |
| 83 | - return CMD_RET_USAGE; | |
| 84 | - if (argc == 3) { | |
| 85 | - if (strcmp(argv[2], "noreset")) | |
| 86 | - return CMD_RET_USAGE; | |
| 87 | - reset_requested = 0; | |
| 88 | - } | |
| 89 | - | |
| 90 | - boot_mode_apply(p->cfg_val); | |
| 91 | - if (reset_requested && p->cfg_val) | |
| 92 | - do_reset(NULL, 0, 0, NULL); | |
| 93 | - return 0; | |
| 94 | -} | |
| 95 | - | |
| 96 | -U_BOOT_CMD( | |
| 97 | - bmode, 3, 0, do_boot_mode, | |
| 98 | - NULL, | |
| 99 | - ""); | |
| 100 | - | |
| 101 | -void add_board_boot_modes(const struct boot_mode *p) | |
| 102 | -{ | |
| 103 | - int size; | |
| 104 | - char *dest; | |
| 105 | - | |
| 106 | - if (__u_boot_cmd_bmode.usage) { | |
| 107 | - free(__u_boot_cmd_bmode.usage); | |
| 108 | - __u_boot_cmd_bmode.usage = NULL; | |
| 109 | - } | |
| 110 | - | |
| 111 | - modes[0] = p; | |
| 112 | - modes[1] = soc_boot_modes; | |
| 113 | - size = create_usage(NULL); | |
| 114 | - dest = malloc(size); | |
| 115 | - if (dest) { | |
| 116 | - create_usage(dest); | |
| 117 | - __u_boot_cmd_bmode.usage = dest; | |
| 118 | - } | |
| 119 | -} |
arch/arm/cpu/armv7/imx-common/cpu.c
| 1 | -/* | |
| 2 | - * (C) Copyright 2007 | |
| 3 | - * Sascha Hauer, Pengutronix | |
| 4 | - * | |
| 5 | - * (C) Copyright 2009 Freescale Semiconductor, Inc. | |
| 6 | - * | |
| 7 | - * See file CREDITS for list of people who contributed to this | |
| 8 | - * project. | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or | |
| 11 | - * modify it under the terms of the GNU General Public License as | |
| 12 | - * published by the Free Software Foundation; either version 2 of | |
| 13 | - * the License, or (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | - * MA 02111-1307 USA | |
| 24 | - */ | |
| 25 | - | |
| 26 | -#include <common.h> | |
| 27 | -#include <asm/errno.h> | |
| 28 | -#include <asm/io.h> | |
| 29 | -#include <asm/arch/imx-regs.h> | |
| 30 | -#include <asm/arch/clock.h> | |
| 31 | -#include <asm/arch/sys_proto.h> | |
| 32 | -#include <asm/arch/crm_regs.h> | |
| 33 | - | |
| 34 | -#ifdef CONFIG_FSL_ESDHC | |
| 35 | -#include <fsl_esdhc.h> | |
| 36 | -#endif | |
| 37 | - | |
| 38 | -char *get_reset_cause(void) | |
| 39 | -{ | |
| 40 | - u32 cause; | |
| 41 | - struct src *src_regs = (struct src *)SRC_BASE_ADDR; | |
| 42 | - | |
| 43 | - cause = readl(&src_regs->srsr); | |
| 44 | - writel(cause, &src_regs->srsr); | |
| 45 | - | |
| 46 | - switch (cause) { | |
| 47 | - case 0x00001: | |
| 48 | - case 0x00011: | |
| 49 | - return "POR"; | |
| 50 | - case 0x00004: | |
| 51 | - return "CSU"; | |
| 52 | - case 0x00008: | |
| 53 | - return "IPP USER"; | |
| 54 | - case 0x00010: | |
| 55 | - return "WDOG"; | |
| 56 | - case 0x00020: | |
| 57 | - return "JTAG HIGH-Z"; | |
| 58 | - case 0x00040: | |
| 59 | - return "JTAG SW"; | |
| 60 | - case 0x10000: | |
| 61 | - return "WARM BOOT"; | |
| 62 | - default: | |
| 63 | - return "unknown reset"; | |
| 64 | - } | |
| 65 | -} | |
| 66 | - | |
| 67 | -#if defined(CONFIG_DISPLAY_CPUINFO) | |
| 68 | - | |
| 69 | -static const char *get_imx_type(u32 imxtype) | |
| 70 | -{ | |
| 71 | - switch (imxtype) { | |
| 72 | - case 0x63: | |
| 73 | - return "6Q"; /* Quad-core version of the mx6 */ | |
| 74 | - case 0x61: | |
| 75 | - return "6DS"; /* Dual/Solo version of the mx6 */ | |
| 76 | - case 0x60: | |
| 77 | - return "6SL"; /* Solo-Lite version of the mx6 */ | |
| 78 | - case 0x51: | |
| 79 | - return "51"; | |
| 80 | - case 0x53: | |
| 81 | - return "53"; | |
| 82 | - default: | |
| 83 | - return "??"; | |
| 84 | - } | |
| 85 | -} | |
| 86 | - | |
| 87 | -int print_cpuinfo(void) | |
| 88 | -{ | |
| 89 | - u32 cpurev; | |
| 90 | - | |
| 91 | - cpurev = get_cpu_rev(); | |
| 92 | - | |
| 93 | - printf("CPU: Freescale i.MX%s rev%d.%d at %d MHz\n", | |
| 94 | - get_imx_type((cpurev & 0xFF000) >> 12), | |
| 95 | - (cpurev & 0x000F0) >> 4, | |
| 96 | - (cpurev & 0x0000F) >> 0, | |
| 97 | - mxc_get_clock(MXC_ARM_CLK) / 1000000); | |
| 98 | - printf("Reset cause: %s\n", get_reset_cause()); | |
| 99 | - return 0; | |
| 100 | -} | |
| 101 | -#endif | |
| 102 | - | |
| 103 | -int cpu_eth_init(bd_t *bis) | |
| 104 | -{ | |
| 105 | - int rc = -ENODEV; | |
| 106 | - | |
| 107 | -#if defined(CONFIG_FEC_MXC) | |
| 108 | - rc = fecmxc_initialize(bis); | |
| 109 | -#endif | |
| 110 | - | |
| 111 | - return rc; | |
| 112 | -} | |
| 113 | - | |
| 114 | -#ifdef CONFIG_FSL_ESDHC | |
| 115 | -/* | |
| 116 | - * Initializes on-chip MMC controllers. | |
| 117 | - * to override, implement board_mmc_init() | |
| 118 | - */ | |
| 119 | -int cpu_mmc_init(bd_t *bis) | |
| 120 | -{ | |
| 121 | - return fsl_esdhc_mmc_init(bis); | |
| 122 | -} | |
| 123 | -#endif | |
| 124 | - | |
| 125 | -void reset_cpu(ulong addr) | |
| 126 | -{ | |
| 127 | - __raw_writew(4, WDOG1_BASE_ADDR); | |
| 128 | -} | |
| 129 | - | |
| 130 | -u32 get_ahb_clk(void) | |
| 131 | -{ | |
| 132 | - struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; | |
| 133 | - u32 reg, ahb_podf; | |
| 134 | - | |
| 135 | - reg = __raw_readl(&imx_ccm->cbcdr); | |
| 136 | - reg &= MXC_CCM_CBCDR_AHB_PODF_MASK; | |
| 137 | - ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET; | |
| 138 | - | |
| 139 | - return get_periph_clk() / (ahb_podf + 1); | |
| 140 | -} |
arch/arm/cpu/armv7/imx-common/i2c.c
| 1 | -/* | |
| 2 | - * Copyright (C) 2012 Boundary Devices Inc. | |
| 3 | - * | |
| 4 | - * See file CREDITS for list of people who contributed to this | |
| 5 | - * project. | |
| 6 | - * | |
| 7 | - * This program is free software; you can redistribute it and/or | |
| 8 | - * modify it under the terms of the GNU General Public License as | |
| 9 | - * published by the Free Software Foundation; either version 2 of | |
| 10 | - * the License, or (at your option) any later version. | |
| 11 | - * | |
| 12 | - * This program is distributed in the hope that it will be useful, | |
| 13 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | - * GNU General Public License for more details. | |
| 16 | - * | |
| 17 | - * You should have received a copy of the GNU General Public License | |
| 18 | - * along with this program; if not, write to the Free Software | |
| 19 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 20 | - * MA 02111-1307 USA | |
| 21 | - */ | |
| 22 | -#include <common.h> | |
| 23 | -#include <asm/arch/clock.h> | |
| 24 | -#include <asm/arch/imx-regs.h> | |
| 25 | -#include <asm/errno.h> | |
| 26 | -#include <asm/gpio.h> | |
| 27 | -#include <asm/imx-common/mxc_i2c.h> | |
| 28 | -#include <watchdog.h> | |
| 29 | - | |
| 30 | -static int force_idle_bus(void *priv) | |
| 31 | -{ | |
| 32 | - int i; | |
| 33 | - int sda, scl; | |
| 34 | - ulong elapsed, start_time; | |
| 35 | - struct i2c_pads_info *p = (struct i2c_pads_info *)priv; | |
| 36 | - int ret = 0; | |
| 37 | - | |
| 38 | - gpio_direction_input(p->sda.gp); | |
| 39 | - gpio_direction_input(p->scl.gp); | |
| 40 | - | |
| 41 | - imx_iomux_v3_setup_pad(p->sda.gpio_mode); | |
| 42 | - imx_iomux_v3_setup_pad(p->scl.gpio_mode); | |
| 43 | - | |
| 44 | - sda = gpio_get_value(p->sda.gp); | |
| 45 | - scl = gpio_get_value(p->scl.gp); | |
| 46 | - if ((sda & scl) == 1) | |
| 47 | - goto exit; /* Bus is idle already */ | |
| 48 | - | |
| 49 | - printf("%s: sda=%d scl=%d sda.gp=0x%x scl.gp=0x%x\n", __func__, | |
| 50 | - sda, scl, p->sda.gp, p->scl.gp); | |
| 51 | - /* Send high and low on the SCL line */ | |
| 52 | - for (i = 0; i < 9; i++) { | |
| 53 | - gpio_direction_output(p->scl.gp, 0); | |
| 54 | - udelay(50); | |
| 55 | - gpio_direction_input(p->scl.gp); | |
| 56 | - udelay(50); | |
| 57 | - } | |
| 58 | - start_time = get_timer(0); | |
| 59 | - for (;;) { | |
| 60 | - sda = gpio_get_value(p->sda.gp); | |
| 61 | - scl = gpio_get_value(p->scl.gp); | |
| 62 | - if ((sda & scl) == 1) | |
| 63 | - break; | |
| 64 | - WATCHDOG_RESET(); | |
| 65 | - elapsed = get_timer(start_time); | |
| 66 | - if (elapsed > (CONFIG_SYS_HZ / 5)) { /* .2 seconds */ | |
| 67 | - ret = -EBUSY; | |
| 68 | - printf("%s: failed to clear bus, sda=%d scl=%d\n", | |
| 69 | - __func__, sda, scl); | |
| 70 | - break; | |
| 71 | - } | |
| 72 | - } | |
| 73 | -exit: | |
| 74 | - imx_iomux_v3_setup_pad(p->sda.i2c_mode); | |
| 75 | - imx_iomux_v3_setup_pad(p->scl.i2c_mode); | |
| 76 | - return ret; | |
| 77 | -} | |
| 78 | - | |
| 79 | -static void * const i2c_bases[] = { | |
| 80 | - (void *)I2C1_BASE_ADDR, | |
| 81 | - (void *)I2C2_BASE_ADDR, | |
| 82 | -#ifdef I2C3_BASE_ADDR | |
| 83 | - (void *)I2C3_BASE_ADDR, | |
| 84 | -#endif | |
| 85 | -}; | |
| 86 | - | |
| 87 | -/* i2c_index can be from 0 - 2 */ | |
| 88 | -void setup_i2c(unsigned i2c_index, int speed, int slave_addr, | |
| 89 | - struct i2c_pads_info *p) | |
| 90 | -{ | |
| 91 | - if (i2c_index >= ARRAY_SIZE(i2c_bases)) | |
| 92 | - return; | |
| 93 | - /* Enable i2c clock */ | |
| 94 | - enable_i2c_clk(1, i2c_index); | |
| 95 | - /* Make sure bus is idle */ | |
| 96 | - force_idle_bus(p); | |
| 97 | - bus_i2c_init(i2c_bases[i2c_index], speed, slave_addr, | |
| 98 | - force_idle_bus, p); | |
| 99 | -} |
arch/arm/cpu/armv7/imx-common/iomux-v3.c
| 1 | -/* | |
| 2 | - * Based on the iomux-v3.c from Linux kernel: | |
| 3 | - * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de> | |
| 4 | - * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, | |
| 5 | - * <armlinux@phytec.de> | |
| 6 | - * | |
| 7 | - * Copyright (C) 2004-2011 Freescale Semiconductor, Inc. | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or | |
| 10 | - * modify it under the terms of the GNU General Public License | |
| 11 | - * as published by the Free Software Foundation; either version 2 | |
| 12 | - * of the License, or (at your option) any later version. | |
| 13 | - * This program is distributed in the hope that it will be useful, | |
| 14 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | - * GNU General Public License for more details. | |
| 17 | - * | |
| 18 | - * You should have received a copy of the GNU General Public License | |
| 19 | - * along with this program; if not, write to the Free Software | |
| 20 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 21 | - * MA 02110-1301, USA. | |
| 22 | - */ | |
| 23 | -#include <common.h> | |
| 24 | -#include <asm/io.h> | |
| 25 | -#include <asm/arch/imx-regs.h> | |
| 26 | -#include <asm/imx-common/iomux-v3.h> | |
| 27 | - | |
| 28 | -static void *base = (void *)IOMUXC_BASE_ADDR; | |
| 29 | - | |
| 30 | -/* | |
| 31 | - * configures a single pad in the iomuxer | |
| 32 | - */ | |
| 33 | -int imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad) | |
| 34 | -{ | |
| 35 | - u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT; | |
| 36 | - u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT; | |
| 37 | - u32 sel_input_ofs = | |
| 38 | - (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT; | |
| 39 | - u32 sel_input = | |
| 40 | - (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT; | |
| 41 | - u32 pad_ctrl_ofs = | |
| 42 | - (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT; | |
| 43 | - u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT; | |
| 44 | - | |
| 45 | - if (mux_ctrl_ofs) | |
| 46 | - __raw_writel(mux_mode, base + mux_ctrl_ofs); | |
| 47 | - | |
| 48 | - if (sel_input_ofs) | |
| 49 | - __raw_writel(sel_input, base + sel_input_ofs); | |
| 50 | - | |
| 51 | - if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs) | |
| 52 | - __raw_writel(pad_ctrl, base + pad_ctrl_ofs); | |
| 53 | - | |
| 54 | - return 0; | |
| 55 | -} | |
| 56 | - | |
| 57 | -int imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) | |
| 58 | -{ | |
| 59 | - iomux_v3_cfg_t *p = pad_list; | |
| 60 | - int i; | |
| 61 | - int ret; | |
| 62 | - | |
| 63 | - for (i = 0; i < count; i++) { | |
| 64 | - ret = imx_iomux_v3_setup_pad(*p); | |
| 65 | - if (ret) | |
| 66 | - return ret; | |
| 67 | - p++; | |
| 68 | - } | |
| 69 | - return 0; | |
| 70 | -} |
arch/arm/cpu/armv7/imx-common/speed.c
| 1 | -/* | |
| 2 | - * (C) Copyright 2000-2003 | |
| 3 | - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
| 4 | - * | |
| 5 | - * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | |
| 6 | - * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | |
| 7 | - * | |
| 8 | - * See file CREDITS for list of people who contributed to this | |
| 9 | - * project. | |
| 10 | - * | |
| 11 | - * This program is free software; you can redistribute it and/or | |
| 12 | - * modify it under the terms of the GNU General Public License as | |
| 13 | - * published by the Free Software Foundation; either version 2 of | |
| 14 | - * the License, or (at your option) any later version. | |
| 15 | - * | |
| 16 | - * This program is distributed in the hope that it will be useful, | |
| 17 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | - * GNU General Public License for more details. | |
| 20 | - * | |
| 21 | - * You should have received a copy of the GNU General Public License | |
| 22 | - * along with this program; if not, write to the Free Software | |
| 23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 24 | - * MA 02111-1307 USA | |
| 25 | - */ | |
| 26 | - | |
| 27 | -#include <common.h> | |
| 28 | -#include <asm/arch/imx-regs.h> | |
| 29 | -#include <asm/arch/clock.h> | |
| 30 | - | |
| 31 | -#ifdef CONFIG_FSL_ESDHC | |
| 32 | -DECLARE_GLOBAL_DATA_PTR; | |
| 33 | -#endif | |
| 34 | - | |
| 35 | -int get_clocks(void) | |
| 36 | -{ | |
| 37 | -#ifdef CONFIG_FSL_ESDHC | |
| 38 | -#ifdef CONFIG_FSL_USDHC | |
| 39 | - gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); | |
| 40 | -#else | |
| 41 | - gd->sdhc_clk = mxc_get_clock(MXC_IPG_PERCLK); | |
| 42 | -#endif | |
| 43 | -#endif | |
| 44 | - return 0; | |
| 45 | -} |
arch/arm/cpu/armv7/imx-common/timer.c
| 1 | -/* | |
| 2 | - * (C) Copyright 2007 | |
| 3 | - * Sascha Hauer, Pengutronix | |
| 4 | - * | |
| 5 | - * (C) Copyright 2009 Freescale Semiconductor, Inc. | |
| 6 | - * | |
| 7 | - * See file CREDITS for list of people who contributed to this | |
| 8 | - * project. | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or | |
| 11 | - * modify it under the terms of the GNU General Public License as | |
| 12 | - * published by the Free Software Foundation; either version 2 of | |
| 13 | - * the License, or (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | - * MA 02111-1307 USA | |
| 24 | - */ | |
| 25 | - | |
| 26 | -#include <common.h> | |
| 27 | -#include <asm/io.h> | |
| 28 | -#include <div64.h> | |
| 29 | -#include <asm/arch/imx-regs.h> | |
| 30 | - | |
| 31 | -/* General purpose timers registers */ | |
| 32 | -struct mxc_gpt { | |
| 33 | - unsigned int control; | |
| 34 | - unsigned int prescaler; | |
| 35 | - unsigned int status; | |
| 36 | - unsigned int nouse[6]; | |
| 37 | - unsigned int counter; | |
| 38 | -}; | |
| 39 | - | |
| 40 | -static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR; | |
| 41 | - | |
| 42 | -/* General purpose timers bitfields */ | |
| 43 | -#define GPTCR_SWR (1 << 15) /* Software reset */ | |
| 44 | -#define GPTCR_FRR (1 << 9) /* Freerun / restart */ | |
| 45 | -#define GPTCR_CLKSOURCE_32 (4 << 6) /* Clock source */ | |
| 46 | -#define GPTCR_TEN 1 /* Timer enable */ | |
| 47 | -#define CLK_32KHZ 32768 /* 32Khz input */ | |
| 48 | - | |
| 49 | -DECLARE_GLOBAL_DATA_PTR; | |
| 50 | - | |
| 51 | -#define timestamp (gd->tbl) | |
| 52 | -#define lastinc (gd->lastinc) | |
| 53 | - | |
| 54 | -static inline unsigned long long tick_to_time(unsigned long long tick) | |
| 55 | -{ | |
| 56 | - tick *= CONFIG_SYS_HZ; | |
| 57 | - do_div(tick, CLK_32KHZ); | |
| 58 | - | |
| 59 | - return tick; | |
| 60 | -} | |
| 61 | - | |
| 62 | -static inline unsigned long long us_to_tick(unsigned long long usec) | |
| 63 | -{ | |
| 64 | - usec = usec * CLK_32KHZ + 999999; | |
| 65 | - do_div(usec, 1000000); | |
| 66 | - | |
| 67 | - return usec; | |
| 68 | -} | |
| 69 | - | |
| 70 | -int timer_init(void) | |
| 71 | -{ | |
| 72 | - int i; | |
| 73 | - ulong val; | |
| 74 | - | |
| 75 | - /* setup GP Timer 1 */ | |
| 76 | - __raw_writel(GPTCR_SWR, &cur_gpt->control); | |
| 77 | - | |
| 78 | - /* We have no udelay by now */ | |
| 79 | - for (i = 0; i < 100; i++) | |
| 80 | - __raw_writel(0, &cur_gpt->control); | |
| 81 | - | |
| 82 | - __raw_writel(0, &cur_gpt->prescaler); /* 32Khz */ | |
| 83 | - | |
| 84 | - /* Freerun Mode, PERCLK1 input */ | |
| 85 | - i = __raw_readl(&cur_gpt->control); | |
| 86 | - __raw_writel(i | GPTCR_CLKSOURCE_32 | GPTCR_TEN, &cur_gpt->control); | |
| 87 | - | |
| 88 | - val = __raw_readl(&cur_gpt->counter); | |
| 89 | - lastinc = val / (CLK_32KHZ / CONFIG_SYS_HZ); | |
| 90 | - timestamp = 0; | |
| 91 | - | |
| 92 | - return 0; | |
| 93 | -} | |
| 94 | - | |
| 95 | -unsigned long long get_ticks(void) | |
| 96 | -{ | |
| 97 | - ulong now = __raw_readl(&cur_gpt->counter); /* current tick value */ | |
| 98 | - | |
| 99 | - if (now >= lastinc) { | |
| 100 | - /* | |
| 101 | - * normal mode (non roll) | |
| 102 | - * move stamp forward with absolut diff ticks | |
| 103 | - */ | |
| 104 | - timestamp += (now - lastinc); | |
| 105 | - } else { | |
| 106 | - /* we have rollover of incrementer */ | |
| 107 | - timestamp += (0xFFFFFFFF - lastinc) + now; | |
| 108 | - } | |
| 109 | - lastinc = now; | |
| 110 | - return timestamp; | |
| 111 | -} | |
| 112 | - | |
| 113 | -ulong get_timer_masked(void) | |
| 114 | -{ | |
| 115 | - /* | |
| 116 | - * get_ticks() returns a long long (64 bit), it wraps in | |
| 117 | - * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 118 | - * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in | |
| 119 | - * 5 * 10^6 days - long enough. | |
| 120 | - */ | |
| 121 | - return tick_to_time(get_ticks()); | |
| 122 | -} | |
| 123 | - | |
| 124 | -ulong get_timer(ulong base) | |
| 125 | -{ | |
| 126 | - return get_timer_masked() - base; | |
| 127 | -} | |
| 128 | - | |
| 129 | -/* delay x useconds AND preserve advance timstamp value */ | |
| 130 | -void __udelay(unsigned long usec) | |
| 131 | -{ | |
| 132 | - unsigned long long tmp; | |
| 133 | - ulong tmo; | |
| 134 | - | |
| 135 | - tmo = us_to_tick(usec); | |
| 136 | - tmp = get_ticks() + tmo; /* get current timestamp */ | |
| 137 | - | |
| 138 | - while (get_ticks() < tmp) /* loop till event */ | |
| 139 | - /*NOP*/; | |
| 140 | -} | |
| 141 | - | |
| 142 | -/* | |
| 143 | - * This function is derived from PowerPC code (timebase clock frequency). | |
| 144 | - * On ARM it returns the number of timer ticks per second. | |
| 145 | - */ | |
| 146 | -ulong get_tbclk(void) | |
| 147 | -{ | |
| 148 | - return CLK_32KHZ; | |
| 149 | -} |
arch/arm/imx-common/Makefile
| 1 | +# | |
| 2 | +# (C) Copyright 2000-2006 | |
| 3 | +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
| 4 | +# | |
| 5 | +# (C) Copyright 2011 Freescale Semiconductor, Inc. | |
| 6 | +# | |
| 7 | +# See file CREDITS for list of people who contributed to this | |
| 8 | +# project. | |
| 9 | +# | |
| 10 | +# This program is free software; you can redistribute it and/or | |
| 11 | +# modify it under the terms of the GNU General Public License as | |
| 12 | +# published by the Free Software Foundation; either version 2 of | |
| 13 | +# the License, or (at your option) any later version. | |
| 14 | +# | |
| 15 | +# This program is distributed in the hope that it will be useful, | |
| 16 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | +# GNU General Public License for more details. | |
| 19 | +# | |
| 20 | +# You should have received a copy of the GNU General Public License | |
| 21 | +# along with this program; if not, write to the Free Software | |
| 22 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | +# MA 02111-1307 USA | |
| 24 | +# | |
| 25 | + | |
| 26 | +include $(TOPDIR)/config.mk | |
| 27 | + | |
| 28 | +LIB = $(obj)libimx-common.o | |
| 29 | + | |
| 30 | +ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) | |
| 31 | +COBJS-y = iomux-v3.o timer.o cpu.o speed.o | |
| 32 | +COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o | |
| 33 | +endif | |
| 34 | +COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o | |
| 35 | +COBJS := $(sort $(COBJS-y)) | |
| 36 | + | |
| 37 | +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | |
| 38 | +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) | |
| 39 | + | |
| 40 | +all: $(obj).depend $(LIB) | |
| 41 | + | |
| 42 | +$(LIB): $(OBJS) | |
| 43 | + $(call cmd_link_o_target, $(OBJS)) | |
| 44 | + | |
| 45 | +######################################################################### | |
| 46 | + | |
| 47 | +# defines $(obj).depend target | |
| 48 | +include $(SRCTREE)/rules.mk | |
| 49 | + | |
| 50 | +sinclude $(obj).depend | |
| 51 | + | |
| 52 | +######################################################################### |
arch/arm/imx-common/cmd_bmode.c
| 1 | +/* | |
| 2 | + * Copyright (C) 2012 Boundary Devices Inc. | |
| 3 | + * | |
| 4 | + * See file CREDITS for list of people who contributed to this | |
| 5 | + * project. | |
| 6 | + * | |
| 7 | + * This program is free software; you can redistribute it and/or | |
| 8 | + * modify it under the terms of the GNU General Public License as | |
| 9 | + * published by the Free Software Foundation; either version 2 of | |
| 10 | + * the License, or (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 20 | + * MA 02111-1307 USA | |
| 21 | + */ | |
| 22 | +#include <common.h> | |
| 23 | +#include <asm/errno.h> | |
| 24 | +#include <asm/io.h> | |
| 25 | +#include <asm/imx-common/boot_mode.h> | |
| 26 | +#include <malloc.h> | |
| 27 | + | |
| 28 | +static const struct boot_mode *modes[2]; | |
| 29 | + | |
| 30 | +static const struct boot_mode *search_modes(char *arg) | |
| 31 | +{ | |
| 32 | + int i; | |
| 33 | + | |
| 34 | + for (i = 0; i < ARRAY_SIZE(modes); i++) { | |
| 35 | + const struct boot_mode *p = modes[i]; | |
| 36 | + if (p) { | |
| 37 | + while (p->name) { | |
| 38 | + if (!strcmp(p->name, arg)) | |
| 39 | + return p; | |
| 40 | + p++; | |
| 41 | + } | |
| 42 | + } | |
| 43 | + } | |
| 44 | + return NULL; | |
| 45 | +} | |
| 46 | + | |
| 47 | +static int create_usage(char *dest) | |
| 48 | +{ | |
| 49 | + int i; | |
| 50 | + int size = 0; | |
| 51 | + | |
| 52 | + for (i = 0; i < ARRAY_SIZE(modes); i++) { | |
| 53 | + const struct boot_mode *p = modes[i]; | |
| 54 | + if (p) { | |
| 55 | + while (p->name) { | |
| 56 | + int len = strlen(p->name); | |
| 57 | + if (dest) { | |
| 58 | + memcpy(dest, p->name, len); | |
| 59 | + dest += len; | |
| 60 | + *dest++ = '|'; | |
| 61 | + } | |
| 62 | + size += len + 1; | |
| 63 | + p++; | |
| 64 | + } | |
| 65 | + } | |
| 66 | + } | |
| 67 | + if (dest) | |
| 68 | + memcpy(dest - 1, " [noreset]", 11); /* include trailing 0 */ | |
| 69 | + size += 10; | |
| 70 | + return size; | |
| 71 | +} | |
| 72 | + | |
| 73 | +static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc, | |
| 74 | + char * const argv[]) | |
| 75 | +{ | |
| 76 | + const struct boot_mode *p; | |
| 77 | + int reset_requested = 1; | |
| 78 | + | |
| 79 | + if (argc < 2) | |
| 80 | + return CMD_RET_USAGE; | |
| 81 | + p = search_modes(argv[1]); | |
| 82 | + if (!p) | |
| 83 | + return CMD_RET_USAGE; | |
| 84 | + if (argc == 3) { | |
| 85 | + if (strcmp(argv[2], "noreset")) | |
| 86 | + return CMD_RET_USAGE; | |
| 87 | + reset_requested = 0; | |
| 88 | + } | |
| 89 | + | |
| 90 | + boot_mode_apply(p->cfg_val); | |
| 91 | + if (reset_requested && p->cfg_val) | |
| 92 | + do_reset(NULL, 0, 0, NULL); | |
| 93 | + return 0; | |
| 94 | +} | |
| 95 | + | |
| 96 | +U_BOOT_CMD( | |
| 97 | + bmode, 3, 0, do_boot_mode, | |
| 98 | + NULL, | |
| 99 | + ""); | |
| 100 | + | |
| 101 | +void add_board_boot_modes(const struct boot_mode *p) | |
| 102 | +{ | |
| 103 | + int size; | |
| 104 | + char *dest; | |
| 105 | + | |
| 106 | + if (__u_boot_cmd_bmode.usage) { | |
| 107 | + free(__u_boot_cmd_bmode.usage); | |
| 108 | + __u_boot_cmd_bmode.usage = NULL; | |
| 109 | + } | |
| 110 | + | |
| 111 | + modes[0] = p; | |
| 112 | + modes[1] = soc_boot_modes; | |
| 113 | + size = create_usage(NULL); | |
| 114 | + dest = malloc(size); | |
| 115 | + if (dest) { | |
| 116 | + create_usage(dest); | |
| 117 | + __u_boot_cmd_bmode.usage = dest; | |
| 118 | + } | |
| 119 | +} |
arch/arm/imx-common/cpu.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007 | |
| 3 | + * Sascha Hauer, Pengutronix | |
| 4 | + * | |
| 5 | + * (C) Copyright 2009 Freescale Semiconductor, Inc. | |
| 6 | + * | |
| 7 | + * See file CREDITS for list of people who contributed to this | |
| 8 | + * project. | |
| 9 | + * | |
| 10 | + * This program is free software; you can redistribute it and/or | |
| 11 | + * modify it under the terms of the GNU General Public License as | |
| 12 | + * published by the Free Software Foundation; either version 2 of | |
| 13 | + * the License, or (at your option) any later version. | |
| 14 | + * | |
| 15 | + * This program is distributed in the hope that it will be useful, | |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | + * GNU General Public License for more details. | |
| 19 | + * | |
| 20 | + * You should have received a copy of the GNU General Public License | |
| 21 | + * along with this program; if not, write to the Free Software | |
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | + * MA 02111-1307 USA | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#include <common.h> | |
| 27 | +#include <asm/errno.h> | |
| 28 | +#include <asm/io.h> | |
| 29 | +#include <asm/arch/imx-regs.h> | |
| 30 | +#include <asm/arch/clock.h> | |
| 31 | +#include <asm/arch/sys_proto.h> | |
| 32 | +#include <asm/arch/crm_regs.h> | |
| 33 | + | |
| 34 | +#ifdef CONFIG_FSL_ESDHC | |
| 35 | +#include <fsl_esdhc.h> | |
| 36 | +#endif | |
| 37 | + | |
| 38 | +char *get_reset_cause(void) | |
| 39 | +{ | |
| 40 | + u32 cause; | |
| 41 | + struct src *src_regs = (struct src *)SRC_BASE_ADDR; | |
| 42 | + | |
| 43 | + cause = readl(&src_regs->srsr); | |
| 44 | + writel(cause, &src_regs->srsr); | |
| 45 | + | |
| 46 | + switch (cause) { | |
| 47 | + case 0x00001: | |
| 48 | + case 0x00011: | |
| 49 | + return "POR"; | |
| 50 | + case 0x00004: | |
| 51 | + return "CSU"; | |
| 52 | + case 0x00008: | |
| 53 | + return "IPP USER"; | |
| 54 | + case 0x00010: | |
| 55 | + return "WDOG"; | |
| 56 | + case 0x00020: | |
| 57 | + return "JTAG HIGH-Z"; | |
| 58 | + case 0x00040: | |
| 59 | + return "JTAG SW"; | |
| 60 | + case 0x10000: | |
| 61 | + return "WARM BOOT"; | |
| 62 | + default: | |
| 63 | + return "unknown reset"; | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +#if defined(CONFIG_DISPLAY_CPUINFO) | |
| 68 | + | |
| 69 | +static const char *get_imx_type(u32 imxtype) | |
| 70 | +{ | |
| 71 | + switch (imxtype) { | |
| 72 | + case 0x63: | |
| 73 | + return "6Q"; /* Quad-core version of the mx6 */ | |
| 74 | + case 0x61: | |
| 75 | + return "6DS"; /* Dual/Solo version of the mx6 */ | |
| 76 | + case 0x60: | |
| 77 | + return "6SL"; /* Solo-Lite version of the mx6 */ | |
| 78 | + case 0x51: | |
| 79 | + return "51"; | |
| 80 | + case 0x53: | |
| 81 | + return "53"; | |
| 82 | + default: | |
| 83 | + return "??"; | |
| 84 | + } | |
| 85 | +} | |
| 86 | + | |
| 87 | +int print_cpuinfo(void) | |
| 88 | +{ | |
| 89 | + u32 cpurev; | |
| 90 | + | |
| 91 | + cpurev = get_cpu_rev(); | |
| 92 | + | |
| 93 | + printf("CPU: Freescale i.MX%s rev%d.%d at %d MHz\n", | |
| 94 | + get_imx_type((cpurev & 0xFF000) >> 12), | |
| 95 | + (cpurev & 0x000F0) >> 4, | |
| 96 | + (cpurev & 0x0000F) >> 0, | |
| 97 | + mxc_get_clock(MXC_ARM_CLK) / 1000000); | |
| 98 | + printf("Reset cause: %s\n", get_reset_cause()); | |
| 99 | + return 0; | |
| 100 | +} | |
| 101 | +#endif | |
| 102 | + | |
| 103 | +int cpu_eth_init(bd_t *bis) | |
| 104 | +{ | |
| 105 | + int rc = -ENODEV; | |
| 106 | + | |
| 107 | +#if defined(CONFIG_FEC_MXC) | |
| 108 | + rc = fecmxc_initialize(bis); | |
| 109 | +#endif | |
| 110 | + | |
| 111 | + return rc; | |
| 112 | +} | |
| 113 | + | |
| 114 | +#ifdef CONFIG_FSL_ESDHC | |
| 115 | +/* | |
| 116 | + * Initializes on-chip MMC controllers. | |
| 117 | + * to override, implement board_mmc_init() | |
| 118 | + */ | |
| 119 | +int cpu_mmc_init(bd_t *bis) | |
| 120 | +{ | |
| 121 | + return fsl_esdhc_mmc_init(bis); | |
| 122 | +} | |
| 123 | +#endif | |
| 124 | + | |
| 125 | +void reset_cpu(ulong addr) | |
| 126 | +{ | |
| 127 | + __raw_writew(4, WDOG1_BASE_ADDR); | |
| 128 | +} | |
| 129 | + | |
| 130 | +u32 get_ahb_clk(void) | |
| 131 | +{ | |
| 132 | + struct mxc_ccm_reg *imx_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; | |
| 133 | + u32 reg, ahb_podf; | |
| 134 | + | |
| 135 | + reg = __raw_readl(&imx_ccm->cbcdr); | |
| 136 | + reg &= MXC_CCM_CBCDR_AHB_PODF_MASK; | |
| 137 | + ahb_podf = reg >> MXC_CCM_CBCDR_AHB_PODF_OFFSET; | |
| 138 | + | |
| 139 | + return get_periph_clk() / (ahb_podf + 1); | |
| 140 | +} |
arch/arm/imx-common/i2c-mxv7.c
| 1 | +/* | |
| 2 | + * Copyright (C) 2012 Boundary Devices Inc. | |
| 3 | + * | |
| 4 | + * See file CREDITS for list of people who contributed to this | |
| 5 | + * project. | |
| 6 | + * | |
| 7 | + * This program is free software; you can redistribute it and/or | |
| 8 | + * modify it under the terms of the GNU General Public License as | |
| 9 | + * published by the Free Software Foundation; either version 2 of | |
| 10 | + * the License, or (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 20 | + * MA 02111-1307 USA | |
| 21 | + */ | |
| 22 | +#include <common.h> | |
| 23 | +#include <asm/arch/clock.h> | |
| 24 | +#include <asm/arch/imx-regs.h> | |
| 25 | +#include <asm/errno.h> | |
| 26 | +#include <asm/gpio.h> | |
| 27 | +#include <asm/imx-common/mxc_i2c.h> | |
| 28 | +#include <watchdog.h> | |
| 29 | + | |
| 30 | +static int force_idle_bus(void *priv) | |
| 31 | +{ | |
| 32 | + int i; | |
| 33 | + int sda, scl; | |
| 34 | + ulong elapsed, start_time; | |
| 35 | + struct i2c_pads_info *p = (struct i2c_pads_info *)priv; | |
| 36 | + int ret = 0; | |
| 37 | + | |
| 38 | + gpio_direction_input(p->sda.gp); | |
| 39 | + gpio_direction_input(p->scl.gp); | |
| 40 | + | |
| 41 | + imx_iomux_v3_setup_pad(p->sda.gpio_mode); | |
| 42 | + imx_iomux_v3_setup_pad(p->scl.gpio_mode); | |
| 43 | + | |
| 44 | + sda = gpio_get_value(p->sda.gp); | |
| 45 | + scl = gpio_get_value(p->scl.gp); | |
| 46 | + if ((sda & scl) == 1) | |
| 47 | + goto exit; /* Bus is idle already */ | |
| 48 | + | |
| 49 | + printf("%s: sda=%d scl=%d sda.gp=0x%x scl.gp=0x%x\n", __func__, | |
| 50 | + sda, scl, p->sda.gp, p->scl.gp); | |
| 51 | + /* Send high and low on the SCL line */ | |
| 52 | + for (i = 0; i < 9; i++) { | |
| 53 | + gpio_direction_output(p->scl.gp, 0); | |
| 54 | + udelay(50); | |
| 55 | + gpio_direction_input(p->scl.gp); | |
| 56 | + udelay(50); | |
| 57 | + } | |
| 58 | + start_time = get_timer(0); | |
| 59 | + for (;;) { | |
| 60 | + sda = gpio_get_value(p->sda.gp); | |
| 61 | + scl = gpio_get_value(p->scl.gp); | |
| 62 | + if ((sda & scl) == 1) | |
| 63 | + break; | |
| 64 | + WATCHDOG_RESET(); | |
| 65 | + elapsed = get_timer(start_time); | |
| 66 | + if (elapsed > (CONFIG_SYS_HZ / 5)) { /* .2 seconds */ | |
| 67 | + ret = -EBUSY; | |
| 68 | + printf("%s: failed to clear bus, sda=%d scl=%d\n", | |
| 69 | + __func__, sda, scl); | |
| 70 | + break; | |
| 71 | + } | |
| 72 | + } | |
| 73 | +exit: | |
| 74 | + imx_iomux_v3_setup_pad(p->sda.i2c_mode); | |
| 75 | + imx_iomux_v3_setup_pad(p->scl.i2c_mode); | |
| 76 | + return ret; | |
| 77 | +} | |
| 78 | + | |
| 79 | +static void * const i2c_bases[] = { | |
| 80 | + (void *)I2C1_BASE_ADDR, | |
| 81 | + (void *)I2C2_BASE_ADDR, | |
| 82 | +#ifdef I2C3_BASE_ADDR | |
| 83 | + (void *)I2C3_BASE_ADDR, | |
| 84 | +#endif | |
| 85 | +}; | |
| 86 | + | |
| 87 | +/* i2c_index can be from 0 - 2 */ | |
| 88 | +void setup_i2c(unsigned i2c_index, int speed, int slave_addr, | |
| 89 | + struct i2c_pads_info *p) | |
| 90 | +{ | |
| 91 | + if (i2c_index >= ARRAY_SIZE(i2c_bases)) | |
| 92 | + return; | |
| 93 | + /* Enable i2c clock */ | |
| 94 | + enable_i2c_clk(1, i2c_index); | |
| 95 | + /* Make sure bus is idle */ | |
| 96 | + force_idle_bus(p); | |
| 97 | + bus_i2c_init(i2c_bases[i2c_index], speed, slave_addr, | |
| 98 | + force_idle_bus, p); | |
| 99 | +} |
arch/arm/imx-common/iomux-v3.c
| 1 | +/* | |
| 2 | + * Based on the iomux-v3.c from Linux kernel: | |
| 3 | + * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de> | |
| 4 | + * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, | |
| 5 | + * <armlinux@phytec.de> | |
| 6 | + * | |
| 7 | + * Copyright (C) 2004-2011 Freescale Semiconductor, Inc. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License | |
| 11 | + * as published by the Free Software Foundation; either version 2 | |
| 12 | + * of the License, or (at your option) any later version. | |
| 13 | + * This program is distributed in the hope that it will be useful, | |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | + * GNU General Public License for more details. | |
| 17 | + * | |
| 18 | + * You should have received a copy of the GNU General Public License | |
| 19 | + * along with this program; if not, write to the Free Software | |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 21 | + * MA 02110-1301, USA. | |
| 22 | + */ | |
| 23 | +#include <common.h> | |
| 24 | +#include <asm/io.h> | |
| 25 | +#include <asm/arch/imx-regs.h> | |
| 26 | +#include <asm/imx-common/iomux-v3.h> | |
| 27 | + | |
| 28 | +static void *base = (void *)IOMUXC_BASE_ADDR; | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * configures a single pad in the iomuxer | |
| 32 | + */ | |
| 33 | +int imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad) | |
| 34 | +{ | |
| 35 | + u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT; | |
| 36 | + u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT; | |
| 37 | + u32 sel_input_ofs = | |
| 38 | + (pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT; | |
| 39 | + u32 sel_input = | |
| 40 | + (pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT; | |
| 41 | + u32 pad_ctrl_ofs = | |
| 42 | + (pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT; | |
| 43 | + u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT; | |
| 44 | + | |
| 45 | + if (mux_ctrl_ofs) | |
| 46 | + __raw_writel(mux_mode, base + mux_ctrl_ofs); | |
| 47 | + | |
| 48 | + if (sel_input_ofs) | |
| 49 | + __raw_writel(sel_input, base + sel_input_ofs); | |
| 50 | + | |
| 51 | + if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs) | |
| 52 | + __raw_writel(pad_ctrl, base + pad_ctrl_ofs); | |
| 53 | + | |
| 54 | + return 0; | |
| 55 | +} | |
| 56 | + | |
| 57 | +int imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) | |
| 58 | +{ | |
| 59 | + iomux_v3_cfg_t *p = pad_list; | |
| 60 | + int i; | |
| 61 | + int ret; | |
| 62 | + | |
| 63 | + for (i = 0; i < count; i++) { | |
| 64 | + ret = imx_iomux_v3_setup_pad(*p); | |
| 65 | + if (ret) | |
| 66 | + return ret; | |
| 67 | + p++; | |
| 68 | + } | |
| 69 | + return 0; | |
| 70 | +} |
arch/arm/imx-common/speed.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2000-2003 | |
| 3 | + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
| 4 | + * | |
| 5 | + * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. | |
| 6 | + * TsiChung Liew (Tsi-Chung.Liew@freescale.com) | |
| 7 | + * | |
| 8 | + * See file CREDITS for list of people who contributed to this | |
| 9 | + * project. | |
| 10 | + * | |
| 11 | + * This program is free software; you can redistribute it and/or | |
| 12 | + * modify it under the terms of the GNU General Public License as | |
| 13 | + * published by the Free Software Foundation; either version 2 of | |
| 14 | + * the License, or (at your option) any later version. | |
| 15 | + * | |
| 16 | + * This program is distributed in the hope that it will be useful, | |
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | + * GNU General Public License for more details. | |
| 20 | + * | |
| 21 | + * You should have received a copy of the GNU General Public License | |
| 22 | + * along with this program; if not, write to the Free Software | |
| 23 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 24 | + * MA 02111-1307 USA | |
| 25 | + */ | |
| 26 | + | |
| 27 | +#include <common.h> | |
| 28 | +#include <asm/arch/imx-regs.h> | |
| 29 | +#include <asm/arch/clock.h> | |
| 30 | + | |
| 31 | +#ifdef CONFIG_FSL_ESDHC | |
| 32 | +DECLARE_GLOBAL_DATA_PTR; | |
| 33 | +#endif | |
| 34 | + | |
| 35 | +int get_clocks(void) | |
| 36 | +{ | |
| 37 | +#ifdef CONFIG_FSL_ESDHC | |
| 38 | +#ifdef CONFIG_FSL_USDHC | |
| 39 | + gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); | |
| 40 | +#else | |
| 41 | + gd->sdhc_clk = mxc_get_clock(MXC_IPG_PERCLK); | |
| 42 | +#endif | |
| 43 | +#endif | |
| 44 | + return 0; | |
| 45 | +} |
arch/arm/imx-common/timer.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007 | |
| 3 | + * Sascha Hauer, Pengutronix | |
| 4 | + * | |
| 5 | + * (C) Copyright 2009 Freescale Semiconductor, Inc. | |
| 6 | + * | |
| 7 | + * See file CREDITS for list of people who contributed to this | |
| 8 | + * project. | |
| 9 | + * | |
| 10 | + * This program is free software; you can redistribute it and/or | |
| 11 | + * modify it under the terms of the GNU General Public License as | |
| 12 | + * published by the Free Software Foundation; either version 2 of | |
| 13 | + * the License, or (at your option) any later version. | |
| 14 | + * | |
| 15 | + * This program is distributed in the hope that it will be useful, | |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | + * GNU General Public License for more details. | |
| 19 | + * | |
| 20 | + * You should have received a copy of the GNU General Public License | |
| 21 | + * along with this program; if not, write to the Free Software | |
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 23 | + * MA 02111-1307 USA | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#include <common.h> | |
| 27 | +#include <asm/io.h> | |
| 28 | +#include <div64.h> | |
| 29 | +#include <asm/arch/imx-regs.h> | |
| 30 | + | |
| 31 | +/* General purpose timers registers */ | |
| 32 | +struct mxc_gpt { | |
| 33 | + unsigned int control; | |
| 34 | + unsigned int prescaler; | |
| 35 | + unsigned int status; | |
| 36 | + unsigned int nouse[6]; | |
| 37 | + unsigned int counter; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR; | |
| 41 | + | |
| 42 | +/* General purpose timers bitfields */ | |
| 43 | +#define GPTCR_SWR (1 << 15) /* Software reset */ | |
| 44 | +#define GPTCR_FRR (1 << 9) /* Freerun / restart */ | |
| 45 | +#define GPTCR_CLKSOURCE_32 (4 << 6) /* Clock source */ | |
| 46 | +#define GPTCR_TEN 1 /* Timer enable */ | |
| 47 | +#define CLK_32KHZ 32768 /* 32Khz input */ | |
| 48 | + | |
| 49 | +DECLARE_GLOBAL_DATA_PTR; | |
| 50 | + | |
| 51 | +#define timestamp (gd->tbl) | |
| 52 | +#define lastinc (gd->lastinc) | |
| 53 | + | |
| 54 | +static inline unsigned long long tick_to_time(unsigned long long tick) | |
| 55 | +{ | |
| 56 | + tick *= CONFIG_SYS_HZ; | |
| 57 | + do_div(tick, CLK_32KHZ); | |
| 58 | + | |
| 59 | + return tick; | |
| 60 | +} | |
| 61 | + | |
| 62 | +static inline unsigned long long us_to_tick(unsigned long long usec) | |
| 63 | +{ | |
| 64 | + usec = usec * CLK_32KHZ + 999999; | |
| 65 | + do_div(usec, 1000000); | |
| 66 | + | |
| 67 | + return usec; | |
| 68 | +} | |
| 69 | + | |
| 70 | +int timer_init(void) | |
| 71 | +{ | |
| 72 | + int i; | |
| 73 | + ulong val; | |
| 74 | + | |
| 75 | + /* setup GP Timer 1 */ | |
| 76 | + __raw_writel(GPTCR_SWR, &cur_gpt->control); | |
| 77 | + | |
| 78 | + /* We have no udelay by now */ | |
| 79 | + for (i = 0; i < 100; i++) | |
| 80 | + __raw_writel(0, &cur_gpt->control); | |
| 81 | + | |
| 82 | + __raw_writel(0, &cur_gpt->prescaler); /* 32Khz */ | |
| 83 | + | |
| 84 | + /* Freerun Mode, PERCLK1 input */ | |
| 85 | + i = __raw_readl(&cur_gpt->control); | |
| 86 | + __raw_writel(i | GPTCR_CLKSOURCE_32 | GPTCR_TEN, &cur_gpt->control); | |
| 87 | + | |
| 88 | + val = __raw_readl(&cur_gpt->counter); | |
| 89 | + lastinc = val / (CLK_32KHZ / CONFIG_SYS_HZ); | |
| 90 | + timestamp = 0; | |
| 91 | + | |
| 92 | + return 0; | |
| 93 | +} | |
| 94 | + | |
| 95 | +unsigned long long get_ticks(void) | |
| 96 | +{ | |
| 97 | + ulong now = __raw_readl(&cur_gpt->counter); /* current tick value */ | |
| 98 | + | |
| 99 | + if (now >= lastinc) { | |
| 100 | + /* | |
| 101 | + * normal mode (non roll) | |
| 102 | + * move stamp forward with absolut diff ticks | |
| 103 | + */ | |
| 104 | + timestamp += (now - lastinc); | |
| 105 | + } else { | |
| 106 | + /* we have rollover of incrementer */ | |
| 107 | + timestamp += (0xFFFFFFFF - lastinc) + now; | |
| 108 | + } | |
| 109 | + lastinc = now; | |
| 110 | + return timestamp; | |
| 111 | +} | |
| 112 | + | |
| 113 | +ulong get_timer_masked(void) | |
| 114 | +{ | |
| 115 | + /* | |
| 116 | + * get_ticks() returns a long long (64 bit), it wraps in | |
| 117 | + * 2^64 / CONFIG_MX25_CLK32 = 2^64 / 2^15 = 2^49 ~ 5 * 10^14 (s) ~ | |
| 118 | + * 5 * 10^9 days... and get_ticks() * CONFIG_SYS_HZ wraps in | |
| 119 | + * 5 * 10^6 days - long enough. | |
| 120 | + */ | |
| 121 | + return tick_to_time(get_ticks()); | |
| 122 | +} | |
| 123 | + | |
| 124 | +ulong get_timer(ulong base) | |
| 125 | +{ | |
| 126 | + return get_timer_masked() - base; | |
| 127 | +} | |
| 128 | + | |
| 129 | +/* delay x useconds AND preserve advance timstamp value */ | |
| 130 | +void __udelay(unsigned long usec) | |
| 131 | +{ | |
| 132 | + unsigned long long tmp; | |
| 133 | + ulong tmo; | |
| 134 | + | |
| 135 | + tmo = us_to_tick(usec); | |
| 136 | + tmp = get_ticks() + tmo; /* get current timestamp */ | |
| 137 | + | |
| 138 | + while (get_ticks() < tmp) /* loop till event */ | |
| 139 | + /*NOP*/; | |
| 140 | +} | |
| 141 | + | |
| 142 | +/* | |
| 143 | + * This function is derived from PowerPC code (timebase clock frequency). | |
| 144 | + * On ARM it returns the number of timer ticks per second. | |
| 145 | + */ | |
| 146 | +ulong get_tbclk(void) | |
| 147 | +{ | |
| 148 | + return CLK_32KHZ; | |
| 149 | +} |
arch/arm/include/asm/arch-mx25/clock.h
| ... | ... | @@ -26,6 +26,20 @@ |
| 26 | 26 | #ifndef __ASM_ARCH_CLOCK_H |
| 27 | 27 | #define __ASM_ARCH_CLOCK_H |
| 28 | 28 | |
| 29 | +#include <common.h> | |
| 30 | + | |
| 31 | +#ifdef CONFIG_MX25_HCLK_FREQ | |
| 32 | +#define MXC_HCLK CONFIG_MX25_HCLK_FREQ | |
| 33 | +#else | |
| 34 | +#define MXC_HCLK 24000000 | |
| 35 | +#endif | |
| 36 | + | |
| 37 | +#ifdef CONFIG_MX25_CLK32 | |
| 38 | +#define MXC_CLK32 CONFIG_MX25_CLK32 | |
| 39 | +#else | |
| 40 | +#define MXC_CLK32 32768 | |
| 41 | +#endif | |
| 42 | + | |
| 29 | 43 | enum mxc_clock { |
| 30 | 44 | MXC_CSI_CLK, |
| 31 | 45 | MXC_EPIT_CLK, |
arch/arm/include/asm/arch-mx31/clock.h
| ... | ... | @@ -24,6 +24,20 @@ |
| 24 | 24 | #ifndef __ASM_ARCH_CLOCK_H |
| 25 | 25 | #define __ASM_ARCH_CLOCK_H |
| 26 | 26 | |
| 27 | +#include <common.h> | |
| 28 | + | |
| 29 | +#ifdef CONFIG_MX31_HCLK_FREQ | |
| 30 | +#define MXC_HCLK CONFIG_MX31_HCLK_FREQ | |
| 31 | +#else | |
| 32 | +#define MXC_HCLK 26000000 | |
| 33 | +#endif | |
| 34 | + | |
| 35 | +#ifdef CONFIG_MX31_CLK32 | |
| 36 | +#define MXC_CLK32 CONFIG_MX31_CLK32 | |
| 37 | +#else | |
| 38 | +#define MXC_CLK32 32768 | |
| 39 | +#endif | |
| 40 | + | |
| 27 | 41 | enum mxc_clock { |
| 28 | 42 | MXC_ARM_CLK, |
| 29 | 43 | MXC_IPG_CLK, |
arch/arm/include/asm/arch-mx35/clock.h
| ... | ... | @@ -24,6 +24,20 @@ |
| 24 | 24 | #ifndef __ASM_ARCH_CLOCK_H |
| 25 | 25 | #define __ASM_ARCH_CLOCK_H |
| 26 | 26 | |
| 27 | +#include <common.h> | |
| 28 | + | |
| 29 | +#ifdef CONFIG_MX35_HCLK_FREQ | |
| 30 | +#define MXC_HCLK CONFIG_MX35_HCLK_FREQ | |
| 31 | +#else | |
| 32 | +#define MXC_HCLK 24000000 | |
| 33 | +#endif | |
| 34 | + | |
| 35 | +#ifdef CONFIG_MX35_CLK32 | |
| 36 | +#define MXC_CLK32 CONFIG_MX35_CLK32 | |
| 37 | +#else | |
| 38 | +#define MXC_CLK32 32768 | |
| 39 | +#endif | |
| 40 | + | |
| 27 | 41 | enum mxc_clock { |
| 28 | 42 | MXC_ARM_CLK, |
| 29 | 43 | MXC_AHB_CLK, |
arch/arm/include/asm/arch-mx35/crm_regs.h
| ... | ... | @@ -32,8 +32,8 @@ |
| 32 | 32 | #define MXC_CCM_CCMR_VOL_RDY_CNT_MASK (0xF << 20) |
| 33 | 33 | #define MXC_CCM_CCMR_ROMW_OFFSET 18 |
| 34 | 34 | #define MXC_CCM_CCMR_ROMW_MASK (0x3 << 18) |
| 35 | -#define MXC_CCM_CCMR_RAMW_OFFSET 21 | |
| 36 | -#define MXC_CCM_CCMR_RAMW_MASK (0x3 << 21) | |
| 35 | +#define MXC_CCM_CCMR_RAMW_OFFSET 16 | |
| 36 | +#define MXC_CCM_CCMR_RAMW_MASK (0x3 << 16) | |
| 37 | 37 | #define MXC_CCM_CCMR_LPM_OFFSET 14 |
| 38 | 38 | #define MXC_CCM_CCMR_LPM_MASK (0x3 << 14) |
| 39 | 39 | #define MXC_CCM_CCMR_UPE (1 << 9) |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | #define MXC_CCM_PDR0_CON_MUX_DIV_MASK (0xF << 16) |
| 48 | 48 | #define MXC_CCM_PDR0_CKIL_SEL (1 << 15) |
| 49 | 49 | #define MXC_CCM_PDR0_PER_PODF_OFFSET 12 |
| 50 | -#define MXC_CCM_PDR0_PER_PODF_MASK (0xF << 12) | |
| 50 | +#define MXC_CCM_PDR0_PER_PODF_MASK (0x7 << 12) | |
| 51 | 51 | #define MXC_CCM_PDR0_AUTO_MUX_DIV_OFFSET 9 |
| 52 | 52 | #define MXC_CCM_PDR0_AUTO_MUX_DIV_MASK (0x7 << 9) |
| 53 | 53 | #define MXC_CCM_PDR0_AUTO_CON 0x1 |
| 54 | 54 | |
| ... | ... | @@ -62,10 +62,8 @@ |
| 62 | 62 | #define MXC_CCM_PDR2_SSI2_PRDF_MASK (0x7 << 27) |
| 63 | 63 | #define MXC_CCM_PDR2_SSI1_PRDF_OFFSET 24 |
| 64 | 64 | #define MXC_CCM_PDR2_SSI1_PRDF_MASK (0x7 << 24) |
| 65 | -#define MXC_CCM_PDR2_CSI_PRDF_OFFSET 19 | |
| 66 | -#define MXC_CCM_PDR2_CSI_PRDF_MASK (0x7 << 19) | |
| 67 | 65 | #define MXC_CCM_PDR2_CSI_PODF_OFFSET 16 |
| 68 | -#define MXC_CCM_PDR2_CSI_PODF_MASK (0x7 << 16) | |
| 66 | +#define MXC_CCM_PDR2_CSI_PODF_MASK (0x3F << 16) | |
| 69 | 67 | #define MXC_CCM_PDR2_SSI2_PODF_OFFSET 8 |
| 70 | 68 | #define MXC_CCM_PDR2_SSI2_PODF_MASK (0x3F << 8) |
| 71 | 69 | #define MXC_CCM_PDR2_CSI_M_U (1 << 7) |
| 72 | 70 | |
| 73 | 71 | |
| 74 | 72 | |
| 75 | 73 | |
| 76 | 74 | |
| 77 | 75 | |
| 78 | 76 | |
| 79 | 77 | |
| ... | ... | @@ -78,35 +76,23 @@ |
| 78 | 76 | #define MXC_CCM_PDR3_SPDIF_PODF_OFFSET 23 |
| 79 | 77 | #define MXC_CCM_PDR3_SPDIF_PODF_MASK (0x3F << 23) |
| 80 | 78 | #define MXC_CCM_PDR3_SPDIF_M_U (1 << 22) |
| 81 | -#define MXC_CCM_PDR3_ESDHC3_PRDF_OFFSET 19 | |
| 82 | -#define MXC_CCM_PDR3_ESDHC3_PRDF_MASK (0x7 << 19) | |
| 83 | 79 | #define MXC_CCM_PDR3_ESDHC3_PODF_OFFSET 16 |
| 84 | -#define MXC_CCM_PDR3_ESDHC3_PODF_MASK (0x7 << 16) | |
| 85 | -#define MXC_CCM_PDR3_UART_M_U (1 << 15) | |
| 86 | -#define MXC_CCM_PDR3_ESDHC2_PRDF_OFFSET 11 | |
| 87 | -#define MXC_CCM_PDR3_ESDHC2_PRDF_MASK (0x7 << 11) | |
| 80 | +#define MXC_CCM_PDR3_ESDHC3_PODF_MASK (0x3F << 16) | |
| 81 | +#define MXC_CCM_PDR3_UART_M_U (1 << 14) | |
| 88 | 82 | #define MXC_CCM_PDR3_ESDHC2_PODF_OFFSET 8 |
| 89 | -#define MXC_CCM_PDR3_ESDHC2_PODF_MASK (0x7 << 8) | |
| 83 | +#define MXC_CCM_PDR3_ESDHC2_PODF_MASK (0x3F << 8) | |
| 90 | 84 | #define MXC_CCM_PDR3_ESDHC_M_U (1 << 6) |
| 91 | -#define MXC_CCM_PDR3_ESDHC1_PRDF_OFFSET 3 | |
| 92 | -#define MXC_CCM_PDR3_ESDHC1_PRDF_MASK (0x7 << 3) | |
| 93 | 85 | #define MXC_CCM_PDR3_ESDHC1_PODF_OFFSET 0 |
| 94 | -#define MXC_CCM_PDR3_ESDHC1_PODF_MASK (0x7) | |
| 86 | +#define MXC_CCM_PDR3_ESDHC1_PODF_MASK (0x3F) | |
| 95 | 87 | |
| 96 | 88 | #define MXC_CCM_PDR4_NFC_PODF_OFFSET 28 |
| 97 | 89 | #define MXC_CCM_PDR4_NFC_PODF_MASK (0xF << 28) |
| 98 | -#define MXC_CCM_PDR4_USB_PRDF_OFFSET 25 | |
| 99 | -#define MXC_CCM_PDR4_USB_PRDF_MASK (0x7 << 25) | |
| 100 | 90 | #define MXC_CCM_PDR4_USB_PODF_OFFSET 22 |
| 101 | -#define MXC_CCM_PDR4_USB_PODF_MASK (0x7 << 22) | |
| 102 | -#define MXC_CCM_PDR4_PER0_PRDF_OFFSET 19 | |
| 103 | -#define MXC_CCM_PDR4_PER0_PRDF_MASK (0x7 << 19) | |
| 91 | +#define MXC_CCM_PDR4_USB_PODF_MASK (0x3F << 22) | |
| 104 | 92 | #define MXC_CCM_PDR4_PER0_PODF_OFFSET 16 |
| 105 | -#define MXC_CCM_PDR4_PER0_PODF_MASK (0x7 << 16) | |
| 106 | -#define MXC_CCM_PDR4_UART_PRDF_OFFSET 13 | |
| 107 | -#define MXC_CCM_PDR4_UART_PRDF_MASK (0x7 << 13) | |
| 93 | +#define MXC_CCM_PDR4_PER0_PODF_MASK (0x3F << 16) | |
| 108 | 94 | #define MXC_CCM_PDR4_UART_PODF_OFFSET 10 |
| 109 | -#define MXC_CCM_PDR4_UART_PODF_MASK (0x7 << 10) | |
| 95 | +#define MXC_CCM_PDR4_UART_PODF_MASK (0x3F << 10) | |
| 110 | 96 | #define MXC_CCM_PDR4_USB_M_U (1 << 9) |
| 111 | 97 | |
| 112 | 98 | /* Bit definitions for RCSR */ |
| ... | ... | @@ -144,6 +130,12 @@ |
| 144 | 130 | #define MXC_CCM_ACMR_SSI2_CLK_SEL_MASK (0xF << 0) |
| 145 | 131 | |
| 146 | 132 | /* Bit definitions for Clock gating Register*/ |
| 133 | +#define MXC_CCM_CGR_CG_MASK 0x3 | |
| 134 | +#define MXC_CCM_CGR_CG_OFF 0x0 | |
| 135 | +#define MXC_CCM_CGR_CG_RUN_ON 0x1 | |
| 136 | +#define MXC_CCM_CGR_CG_RUN_WAIT_ON 0x2 | |
| 137 | +#define MXC_CCM_CGR_CG_ON 0x3 | |
| 138 | + | |
| 147 | 139 | #define MXC_CCM_CGR0_ASRC_OFFSET 0 |
| 148 | 140 | #define MXC_CCM_CGR0_ASRC_MASK (0x3 << 0) |
| 149 | 141 | #define MXC_CCM_CGR0_ATA_OFFSET 2 |
| ... | ... | @@ -251,10 +243,8 @@ |
| 251 | 243 | #define MXC_CCM_COSR_CLKOSEL_OFFSET 0 |
| 252 | 244 | #define MXC_CCM_COSR_CLKOEN (1 << 5) |
| 253 | 245 | #define MXC_CCM_COSR_CLKOUTDIV_1 (1 << 6) |
| 254 | -#define MXC_CCM_COSR_CLKOUT_PREDIV_MASK (0x7 << 10) | |
| 255 | -#define MXC_CCM_COSR_CLKOUT_PREDIV_OFFSET 10 | |
| 256 | -#define MXC_CCM_COSR_CLKOUT_PRODIV_MASK (0x7 << 13) | |
| 257 | -#define MXC_CCM_COSR_CLKOUT_PRODIV_OFFSET 13 | |
| 246 | +#define MXC_CCM_COSR_CLKOUT_DIV_MASK (0x3F << 10) | |
| 247 | +#define MXC_CCM_COSR_CLKOUT_DIV_OFFSET 10 | |
| 258 | 248 | #define MXC_CCM_COSR_SSI1_RX_SRC_SEL_MASK (0x3 << 16) |
| 259 | 249 | #define MXC_CCM_COSR_SSI1_RX_SRC_SEL_OFFSET 16 |
| 260 | 250 | #define MXC_CCM_COSR_SSI1_TX_SRC_SEL_MASK (0x3 << 18) |
arch/arm/include/asm/arch-mx6/iomux.h
| ... | ... | @@ -34,21 +34,21 @@ |
| 34 | 34 | #define IOMUXC_GPR13_SATA_PHY_2_MASK (0x1f<<2) |
| 35 | 35 | #define IOMUXC_GPR13_SATA_PHY_1_MASK (3<<0) |
| 36 | 36 | |
| 37 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_0P5DB (0b000<<24) | |
| 38 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P0DB (0b001<<24) | |
| 39 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P5DB (0b010<<24) | |
| 40 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P0DB (0b011<<24) | |
| 41 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P5DB (0b100<<24) | |
| 42 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB (0b101<<24) | |
| 43 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P5DB (0b110<<24) | |
| 44 | -#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_4P0DB (0b111<<24) | |
| 37 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_0P5DB (0<<24) | |
| 38 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P0DB (1<<24) | |
| 39 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_1P5DB (2<<24) | |
| 40 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P0DB (3<<24) | |
| 41 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_2P5DB (4<<24) | |
| 42 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB (5<<24) | |
| 43 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P5DB (6<<24) | |
| 44 | +#define IOMUXC_GPR13_SATA_PHY_8_RXEQ_4P0DB (7<<24) | |
| 45 | 45 | |
| 46 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA1I (0b10000<<19) | |
| 47 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA1M (0b10000<<19) | |
| 48 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA1X (0b11010<<19) | |
| 49 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA2I (0b10010<<19) | |
| 50 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA2M (0b10010<<19) | |
| 51 | -#define IOMUXC_GPR13_SATA_PHY_7_SATA2X (0b11010<<19) | |
| 46 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA1I (0x10<<19) | |
| 47 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA1M (0x10<<19) | |
| 48 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA1X (0x1A<<19) | |
| 49 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA2I (0x12<<19) | |
| 50 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA2M (0x12<<19) | |
| 51 | +#define IOMUXC_GPR13_SATA_PHY_7_SATA2X (0x1A<<19) | |
| 52 | 52 | |
| 53 | 53 | #define IOMUXC_GPR13_SATA_SPEED_1P5G (0<<15) |
| 54 | 54 | #define IOMUXC_GPR13_SATA_SPEED_3G (1<<15) |
| 55 | 55 | |
| ... | ... | @@ -63,55 +63,55 @@ |
| 63 | 63 | #define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_9_16 (4<<11) |
| 64 | 64 | #define IOMUXC_GPR13_SATA_SATA_PHY_4_ATTEN_8_16 (5<<11) |
| 65 | 65 | |
| 66 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB (0b0000<<7) | |
| 67 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P37_DB (0b0001<<7) | |
| 68 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P74_DB (0b0010<<7) | |
| 69 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P11_DB (0b0011<<7) | |
| 70 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P48_DB (0b0100<<7) | |
| 71 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P85_DB (0b0101<<7) | |
| 72 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P22_DB (0b0110<<7) | |
| 73 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P59_DB (0b0111<<7) | |
| 74 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P96_DB (0b1000<<7) | |
| 75 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P33_DB (0b1001<<7) | |
| 76 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P70_DB (0b1010<<7) | |
| 77 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P07_DB (0b1011<<7) | |
| 78 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P44_DB (0b1100<<7) | |
| 79 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P81_DB (0b1101<<7) | |
| 80 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P28_DB (0b1110<<7) | |
| 81 | -#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P75_DB (0b1111<<7) | |
| 66 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P00_DB (0<<7) | |
| 67 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P37_DB (1<<7) | |
| 68 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_0P74_DB (2<<7) | |
| 69 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P11_DB (3<<7) | |
| 70 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P48_DB (4<<7) | |
| 71 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_1P85_DB (5<<7) | |
| 72 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P22_DB (6<<7) | |
| 73 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P59_DB (7<<7) | |
| 74 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_2P96_DB (8<<7) | |
| 75 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P33_DB (9<<7) | |
| 76 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_3P70_DB (0xA<<7) | |
| 77 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P07_DB (0xB<<7) | |
| 78 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P44_DB (0xC<<7) | |
| 79 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_4P81_DB (0xD<<7) | |
| 80 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P28_DB (0xE<<7) | |
| 81 | +#define IOMUXC_GPR13_SATA_PHY_3_TXBOOST_5P75_DB (0xF<<7) | |
| 82 | 82 | |
| 83 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P937V (0b00000<<2) | |
| 84 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P947V (0b00001<<2) | |
| 85 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P957V (0b00010<<2) | |
| 86 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P966V (0b00011<<2) | |
| 87 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P976V (0b00100<<2) | |
| 88 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P986V (0b00101<<2) | |
| 89 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_0P996V (0b00110<<2) | |
| 90 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P005V (0b00111<<2) | |
| 91 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P015V (0b01000<<2) | |
| 92 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P025V (0b01001<<2) | |
| 93 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P035V (0b01010<<2) | |
| 94 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P045V (0b01011<<2) | |
| 95 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P054V (0b01100<<2) | |
| 96 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P064V (0b01101<<2) | |
| 97 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P074V (0b01110<<2) | |
| 98 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P084V (0b01111<<2) | |
| 99 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P094V (0b10000<<2) | |
| 100 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P104V (0b10001<<2) | |
| 101 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P113V (0b10010<<2) | |
| 102 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P123V (0b10011<<2) | |
| 103 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P133V (0b10100<<2) | |
| 104 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P143V (0b10101<<2) | |
| 105 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P152V (0b10110<<2) | |
| 106 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P162V (0b10111<<2) | |
| 107 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P172V (0b11000<<2) | |
| 108 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P182V (0b11001<<2) | |
| 109 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P191V (0b11010<<2) | |
| 110 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P201V (0b11011<<2) | |
| 111 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P211V (0b11100<<2) | |
| 112 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P221V (0b11101<<2) | |
| 113 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P230V (0b11110<<2) | |
| 114 | -#define IOMUXC_GPR13_SATA_PHY_2_TX_1P240V (0b11111<<2) | |
| 83 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P937V (0<<2) | |
| 84 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P947V (1<<2) | |
| 85 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P957V (2<<2) | |
| 86 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P966V (3<<2) | |
| 87 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P976V (4<<2) | |
| 88 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P986V (5<<2) | |
| 89 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_0P996V (6<<2) | |
| 90 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P005V (7<<2) | |
| 91 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P015V (8<<2) | |
| 92 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P025V (9<<2) | |
| 93 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P035V (0xA<<2) | |
| 94 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P045V (0xB<<2) | |
| 95 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P054V (0xC<<2) | |
| 96 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P064V (0xD<<2) | |
| 97 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P074V (0xE<<2) | |
| 98 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P084V (0xF<<2) | |
| 99 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P094V (0x10<<2) | |
| 100 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P104V (0x11<<2) | |
| 101 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P113V (0x12<<2) | |
| 102 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P123V (0x13<<2) | |
| 103 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P133V (0x14<<2) | |
| 104 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P143V (0x15<<2) | |
| 105 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P152V (0x16<<2) | |
| 106 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P162V (0x17<<2) | |
| 107 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P172V (0x18<<2) | |
| 108 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P182V (0x19<<2) | |
| 109 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P191V (0x1A<<2) | |
| 110 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P201V (0x1B<<2) | |
| 111 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P211V (0x1C<<2) | |
| 112 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P221V (0x1D<<2) | |
| 113 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P230V (0x1E<<2) | |
| 114 | +#define IOMUXC_GPR13_SATA_PHY_2_TX_1P240V (0x1F<<2) | |
| 115 | 115 | |
| 116 | 116 | #define IOMUXC_GPR13_SATA_PHY_1_FAST 0 |
| 117 | 117 | #define IOMUXC_GPR13_SATA_PHY_1_MEDIUM 1 |
board/freescale/mx28evk/iomux.c
| ... | ... | @@ -173,7 +173,7 @@ |
| 173 | 173 | #define HW_DRAM_CTL29_CONFIG (CS_MAP << 24 | COLUMN_SIZE << 16 | \ |
| 174 | 174 | ADDR_PINS << 8 | APREBIT) |
| 175 | 175 | |
| 176 | -void mx28_adjust_memory_params(uint32_t *dram_vals) | |
| 176 | +void mxs_adjust_memory_params(uint32_t *dram_vals) | |
| 177 | 177 | { |
| 178 | 178 | dram_vals[HW_DRAM_CTL29] = HW_DRAM_CTL29_CONFIG; |
| 179 | 179 | } |
board/freescale/mx28evk/mx28evk.c
| ... | ... | @@ -49,8 +49,8 @@ |
| 49 | 49 | |
| 50 | 50 | /* SSP0 clock at 96MHz */ |
| 51 | 51 | mx28_set_sspclk(MXC_SSPCLK0, 96000, 0); |
| 52 | - /* SSP2 clock at 96MHz */ | |
| 53 | - mx28_set_sspclk(MXC_SSPCLK2, 96000, 0); | |
| 52 | + /* SSP2 clock at 160MHz */ | |
| 53 | + mx28_set_sspclk(MXC_SSPCLK2, 160000, 0); | |
| 54 | 54 | |
| 55 | 55 | #ifdef CONFIG_CMD_USB |
| 56 | 56 | mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT); |
board/freescale/mx35pdk/README
| ... | ... | @@ -71,90 +71,16 @@ |
| 71 | 71 | Flashing U-Boot |
| 72 | 72 | -------------------------------- |
| 73 | 73 | |
| 74 | -There are two options: the original bootloader in NAND can be replaced with | |
| 75 | -u-boot, or u-boot can be stored on the NOR flash without erasing | |
| 76 | -the delivered bootloader. | |
| 74 | +U-boot should be stored on the NOR flash. | |
| 75 | + | |
| 77 | 76 | The boot storage can be select using the switches on the personality board |
| 78 | 77 | (SW1-SW2) and on the DEBUG board (SW4-SW10). |
| 79 | 78 | |
| 80 | -The second option is to be preferred if you have not a JTAG debugger. | |
| 81 | 79 | If something goes wrong flashing the bootloader, it is always possible to |
| 82 | 80 | recover the board booting from the other device. |
| 83 | 81 | |
| 84 | -Replacing the bootloader on the NAND | |
| 85 | --------------------------------------- | |
| 86 | -To replace RedBoot with U-Boot, the easy way is to do this in linux. | |
| 87 | -Start the kernel with the suggested options. Make sure to have set the | |
| 88 | -mtdparts exactly as described, because this matches the layout on the | |
| 89 | -mx35pdk. | |
| 90 | - | |
| 91 | -You should see in your boot log the following entries for the NAND | |
| 92 | -flash: | |
| 93 | - | |
| 94 | -5 cmdlinepart partitions found on MTD device mxc_nand | |
| 95 | -Creating 5 MTD partitions on "mxc_nand": | |
| 96 | -0x000000000000-0x000000100000 : "boot" | |
| 97 | -0x000000100000-0x000000600000 : "linux" | |
| 98 | -0x000000600000-0x000006600000 : "root" | |
| 99 | -0x000006600000-0x000006e00000 : "cfg" | |
| 100 | -0x000006e00000-0x000080000000 : "user" | |
| 101 | - | |
| 102 | -You can use the utilities flash_eraseall and nandwrite to put | |
| 103 | -u-boot on the NAND. The bootloader is marked as "boot", and 1MB is | |
| 104 | -reserved. If everything is correct, this partition is accessed as | |
| 105 | -/dev/mtd4. However, check if it is correct with "cat /proc/mtd" and | |
| 106 | -get the device node from the partition name: | |
| 107 | - | |
| 108 | -$ cat /proc/mtd | grep boot | |
| 109 | - | |
| 110 | -I suggest you try the utilities on a different partition to be sure | |
| 111 | -if everything works correctly. If not, and you remove RedBoot, you have to | |
| 112 | -reinstall it using the ATK tool as suggested by Freescale, or using a | |
| 113 | -JTAG debugger. | |
| 114 | - | |
| 115 | -I report the versions of the utilities I used (they are provided with ELDK): | |
| 116 | - | |
| 117 | --bash-3.2# nandwrite --version | |
| 118 | -nandwrite $Revision: 1.32 $ | |
| 119 | - | |
| 120 | -flash_eraseall --version | |
| 121 | -flash_eraseall $Revision: 1.22 $ | |
| 122 | - | |
| 123 | -nandwrite reports a warning if the file to be saved is not sector aligned. | |
| 124 | -This should have no consequences, but I preferred to pad u-boot.bin | |
| 125 | -to get no problem at all. | |
| 126 | -$ dd if=/dev/zero of=zeros bs=1 count=74800 | |
| 127 | -$ cat u-boot.bin zeros > u-boot-padded.bin | |
| 128 | - | |
| 129 | -To erase the partition: | |
| 130 | -$ flash_eraseall /dev/mtd4 | |
| 131 | - | |
| 132 | -Writing u-boot: | |
| 133 | - | |
| 134 | -$ nandwrite /dev/mtd4 u-boot-padded.bin | |
| 135 | - | |
| 136 | -Now U-Boot is stored on the booting partition. | |
| 137 | - | |
| 138 | -To boot from NAND, you have to select the switches as follows: | |
| 139 | - | |
| 140 | -Personality board | |
| 141 | - SW2 1, 4, 5 on | |
| 142 | - 2, 3, 6, 7, 8 off | |
| 143 | - SW1 all off | |
| 144 | - | |
| 145 | -Debug Board: | |
| 146 | - SW5 0 | |
| 147 | - SW6 0 | |
| 148 | - SW7 0 | |
| 149 | - SW8 1 | |
| 150 | - SW9 1 | |
| 151 | - SW10 0 | |
| 152 | - | |
| 153 | - | |
| 154 | 82 | Saving U-Boot in the NOR flash |
| 155 | 83 | --------------------------------- |
| 156 | - | |
| 157 | -The procedure to save in the NOR flash is quite the same as to write into the NAND. | |
| 158 | 84 | |
| 159 | 85 | Check the partition for boot in the NOR flash. Setting the mtdparts as reported, |
| 160 | 86 | the boot partition should be /dev/mtd0. |
board/freescale/mx35pdk/mx35pdk.c
| ... | ... | @@ -32,6 +32,8 @@ |
| 32 | 32 | #include <i2c.h> |
| 33 | 33 | #include <pmic.h> |
| 34 | 34 | #include <fsl_pmic.h> |
| 35 | +#include <mmc.h> | |
| 36 | +#include <fsl_esdhc.h> | |
| 35 | 37 | #include <mc9sdz60.h> |
| 36 | 38 | #include <mc13892.h> |
| 37 | 39 | #include <linux/types.h> |
| ... | ... | @@ -275,4 +277,27 @@ |
| 275 | 277 | |
| 276 | 278 | return rc; |
| 277 | 279 | } |
| 280 | + | |
| 281 | +#if defined(CONFIG_FSL_ESDHC) | |
| 282 | + | |
| 283 | +struct fsl_esdhc_cfg esdhc_cfg = {MMC_SDHC1_BASE_ADDR}; | |
| 284 | + | |
| 285 | +int board_mmc_init(bd_t *bis) | |
| 286 | +{ | |
| 287 | + /* configure pins for SDHC1 only */ | |
| 288 | + mxc_request_iomux(MX35_PIN_SD1_CMD, MUX_CONFIG_FUNC); | |
| 289 | + mxc_request_iomux(MX35_PIN_SD1_CLK, MUX_CONFIG_FUNC); | |
| 290 | + mxc_request_iomux(MX35_PIN_SD1_DATA0, MUX_CONFIG_FUNC); | |
| 291 | + mxc_request_iomux(MX35_PIN_SD1_DATA1, MUX_CONFIG_FUNC); | |
| 292 | + mxc_request_iomux(MX35_PIN_SD1_DATA2, MUX_CONFIG_FUNC); | |
| 293 | + mxc_request_iomux(MX35_PIN_SD1_DATA3, MUX_CONFIG_FUNC); | |
| 294 | + | |
| 295 | + return fsl_esdhc_initialize(bis, &esdhc_cfg); | |
| 296 | +} | |
| 297 | + | |
| 298 | +int board_mmc_getcd(struct mmc *mmc) | |
| 299 | +{ | |
| 300 | + return !(mc9sdz60_reg_read(MC9SDZ60_REG_DES_FLAG) & 0x4); | |
| 301 | +} | |
| 302 | +#endif |
board/freescale/mx6qsabrelite/mx6qsabrelite.c
| ... | ... | @@ -197,18 +197,18 @@ |
| 197 | 197 | |
| 198 | 198 | static void setup_iomux_enet(void) |
| 199 | 199 | { |
| 200 | - gpio_direction_output(87, 0); /* GPIO 3-23 */ | |
| 201 | - gpio_direction_output(190, 1); /* GPIO 6-30 */ | |
| 202 | - gpio_direction_output(185, 1); /* GPIO 6-25 */ | |
| 203 | - gpio_direction_output(187, 1); /* GPIO 6-27 */ | |
| 204 | - gpio_direction_output(188, 1); /* GPIO 6-28*/ | |
| 205 | - gpio_direction_output(189, 1); /* GPIO 6-29 */ | |
| 200 | + gpio_direction_output(IMX_GPIO_NR(3, 23), 0); | |
| 201 | + gpio_direction_output(IMX_GPIO_NR(6, 30), 1); | |
| 202 | + gpio_direction_output(IMX_GPIO_NR(6, 25), 1); | |
| 203 | + gpio_direction_output(IMX_GPIO_NR(6, 27), 1); | |
| 204 | + gpio_direction_output(IMX_GPIO_NR(6, 28), 1); | |
| 205 | + gpio_direction_output(IMX_GPIO_NR(6, 29), 1); | |
| 206 | 206 | imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1)); |
| 207 | - gpio_direction_output(184, 1); /* GPIO 6-24 */ | |
| 207 | + gpio_direction_output(IMX_GPIO_NR(6, 24), 1); | |
| 208 | 208 | |
| 209 | 209 | /* Need delay 10ms according to KSZ9021 spec */ |
| 210 | 210 | udelay(1000 * 10); |
| 211 | - gpio_set_value(87, 1); /* GPIO 3-23 */ | |
| 211 | + gpio_set_value(IMX_GPIO_NR(3, 23), 1); | |
| 212 | 212 | |
| 213 | 213 | imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2)); |
| 214 | 214 | } |
| 215 | 215 | |
| ... | ... | @@ -249,11 +249,11 @@ |
| 249 | 249 | int ret; |
| 250 | 250 | |
| 251 | 251 | if (cfg->esdhc_base == USDHC3_BASE_ADDR) { |
| 252 | - gpio_direction_input(192); /*GPIO7_0*/ | |
| 253 | - ret = !gpio_get_value(192); | |
| 252 | + gpio_direction_input(IMX_GPIO_NR(7, 0)); | |
| 253 | + ret = !gpio_get_value(IMX_GPIO_NR(7, 0)); | |
| 254 | 254 | } else { |
| 255 | - gpio_direction_input(38); /*GPIO2_6*/ | |
| 256 | - ret = !gpio_get_value(38); | |
| 255 | + gpio_direction_input(IMX_GPIO_NR(2, 6)); | |
| 256 | + ret = !gpio_get_value(IMX_GPIO_NR(2, 6)); | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | return ret; |
board/genesi/mx51_efikamx/Makefile
board/genesi/mx51_efikamx/efikamx-usb.c
| ... | ... | @@ -214,4 +214,16 @@ |
| 214 | 214 | if (port) |
| 215 | 215 | mdelay(10); |
| 216 | 216 | } |
| 217 | + | |
| 218 | +/* | |
| 219 | + * Ethernet on the Smarttop is on the USB bus. Rather than give an error about | |
| 220 | + * "CPU Net Initialization Failed", just pass this test since no other settings | |
| 221 | + * are required. Smartbook doesn't have built-in Ethernet but we will let it | |
| 222 | + * pass anyway considering someone may have plugged in a USB stick and all | |
| 223 | + * they need to do is run "usb start". | |
| 224 | + */ | |
| 225 | +int board_eth_init(bd_t *bis) | |
| 226 | +{ | |
| 227 | + return 0; | |
| 228 | +} |
board/genesi/mx51_efikamx/efikamx.c
drivers/mmc/mxsmmc.c
| ... | ... | @@ -119,6 +119,10 @@ |
| 119 | 119 | (uint32_t)(priv->desc->cmd.address + cache_data_count)); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | + /* Invalidate the area, so no writeback into the RAM races with DMA */ | |
| 123 | + invalidate_dcache_range((uint32_t)priv->desc->cmd.address, | |
| 124 | + (uint32_t)(priv->desc->cmd.address + cache_data_count)); | |
| 125 | + | |
| 122 | 126 | priv->desc->cmd.data |= MXS_DMA_DESC_IRQ | MXS_DMA_DESC_DEC_SEM | |
| 123 | 127 | (data_count << MXS_DMA_DESC_BYTES_OFFSET); |
| 124 | 128 |
drivers/spi/mxs_spi.c
| ... | ... | @@ -224,8 +224,10 @@ |
| 224 | 224 | struct mxs_dma_desc *dp; |
| 225 | 225 | uint32_t ctrl0; |
| 226 | 226 | uint32_t cache_data_count; |
| 227 | + const uint32_t dstart = (uint32_t)data; | |
| 227 | 228 | int dmach; |
| 228 | 229 | int tl; |
| 230 | + int ret = 0; | |
| 229 | 231 | |
| 230 | 232 | ALLOC_CACHE_ALIGN_BUFFER(struct mxs_dma_desc, desc, desc_count); |
| 231 | 233 | |
| 232 | 234 | |
| 233 | 235 | |
| 234 | 236 | |
| ... | ... | @@ -239,18 +241,18 @@ |
| 239 | 241 | if (!write) |
| 240 | 242 | ctrl0 |= SSP_CTRL0_READ; |
| 241 | 243 | |
| 242 | - writel(length, &ssp_regs->hw_ssp_xfer_size); | |
| 243 | - | |
| 244 | 244 | if (length % ARCH_DMA_MINALIGN) |
| 245 | 245 | cache_data_count = roundup(length, ARCH_DMA_MINALIGN); |
| 246 | 246 | else |
| 247 | 247 | cache_data_count = length; |
| 248 | 248 | |
| 249 | + /* Flush data to DRAM so DMA can pick them up */ | |
| 249 | 250 | if (write) |
| 250 | - /* Flush data to DRAM so DMA can pick them up */ | |
| 251 | - flush_dcache_range((uint32_t)data, | |
| 252 | - (uint32_t)(data + cache_data_count)); | |
| 251 | + flush_dcache_range(dstart, dstart + cache_data_count); | |
| 253 | 252 | |
| 253 | + /* Invalidate the area, so no writeback into the RAM races with DMA */ | |
| 254 | + invalidate_dcache_range(dstart, dstart + cache_data_count); | |
| 255 | + | |
| 254 | 256 | dmach = MXS_DMA_CHANNEL_AHB_APBH_SSP0 + slave->slave.bus; |
| 255 | 257 | |
| 256 | 258 | dp = desc; |
| 257 | 259 | |
| 258 | 260 | |
| 259 | 261 | |
| 260 | 262 | |
| 261 | 263 | |
| 262 | 264 | |
| ... | ... | @@ -281,41 +283,47 @@ |
| 281 | 283 | tl = min(length, xfer_max_sz); |
| 282 | 284 | |
| 283 | 285 | dp->cmd.data |= |
| 284 | - (tl << MXS_DMA_DESC_BYTES_OFFSET) | | |
| 285 | - (1 << MXS_DMA_DESC_PIO_WORDS_OFFSET) | | |
| 286 | + ((tl & 0xffff) << MXS_DMA_DESC_BYTES_OFFSET) | | |
| 287 | + (4 << MXS_DMA_DESC_PIO_WORDS_OFFSET) | | |
| 286 | 288 | MXS_DMA_DESC_HALT_ON_TERMINATE | |
| 287 | 289 | MXS_DMA_DESC_TERMINATE_FLUSH; |
| 288 | - dp->cmd.pio_words[0] = ctrl0; | |
| 289 | 290 | |
| 290 | 291 | data += tl; |
| 291 | 292 | length -= tl; |
| 292 | 293 | |
| 294 | + if (!length) { | |
| 295 | + dp->cmd.data |= MXS_DMA_DESC_IRQ | MXS_DMA_DESC_DEC_SEM; | |
| 296 | + | |
| 297 | + if (flags & SPI_XFER_END) { | |
| 298 | + ctrl0 &= ~SSP_CTRL0_LOCK_CS; | |
| 299 | + ctrl0 |= SSP_CTRL0_IGNORE_CRC; | |
| 300 | + } | |
| 301 | + } | |
| 302 | + | |
| 303 | + /* | |
| 304 | + * Write CTRL0, CMD0, CMD1, XFER_SIZE registers. It is | |
| 305 | + * essential that the XFER_SIZE register is written on | |
| 306 | + * a per-descriptor basis with the same size as is the | |
| 307 | + * descriptor! | |
| 308 | + */ | |
| 309 | + dp->cmd.pio_words[0] = ctrl0; | |
| 310 | + dp->cmd.pio_words[1] = 0; | |
| 311 | + dp->cmd.pio_words[2] = 0; | |
| 312 | + dp->cmd.pio_words[3] = tl; | |
| 313 | + | |
| 293 | 314 | mxs_dma_desc_append(dmach, dp); |
| 294 | 315 | |
| 295 | 316 | dp++; |
| 296 | 317 | } |
| 297 | 318 | |
| 298 | - dp->address = (dma_addr_t)dp; | |
| 299 | - dp->cmd.address = (dma_addr_t)0; | |
| 300 | - dp->cmd.data = MXS_DMA_DESC_COMMAND_NO_DMAXFER | | |
| 301 | - (1 << MXS_DMA_DESC_PIO_WORDS_OFFSET) | | |
| 302 | - MXS_DMA_DESC_IRQ | MXS_DMA_DESC_DEC_SEM; | |
| 303 | - if (flags & SPI_XFER_END) { | |
| 304 | - ctrl0 &= ~SSP_CTRL0_LOCK_CS; | |
| 305 | - dp->cmd.pio_words[0] = ctrl0 | SSP_CTRL0_IGNORE_CRC; | |
| 306 | - } | |
| 307 | - mxs_dma_desc_append(dmach, dp); | |
| 308 | - | |
| 309 | 319 | if (mxs_dma_go(dmach)) |
| 310 | - return -EINVAL; | |
| 320 | + ret = -EINVAL; | |
| 311 | 321 | |
| 312 | 322 | /* The data arrived into DRAM, invalidate cache over them */ |
| 313 | - if (!write) { | |
| 314 | - invalidate_dcache_range((uint32_t)data, | |
| 315 | - (uint32_t)(data + cache_data_count)); | |
| 316 | - } | |
| 323 | + if (!write) | |
| 324 | + invalidate_dcache_range(dstart, dstart + cache_data_count); | |
| 317 | 325 | |
| 318 | - return 0; | |
| 326 | + return ret; | |
| 319 | 327 | } |
| 320 | 328 | |
| 321 | 329 | int spi_xfer(struct spi_slave *slave, unsigned int bitlen, |
include/configs/flea3.h
include/configs/ima3-mx53.h
| ... | ... | @@ -64,7 +64,6 @@ |
| 64 | 64 | /* Ethernet on FEC */ |
| 65 | 65 | #define CONFIG_NET_MULTI |
| 66 | 66 | #define CONFIG_MII |
| 67 | -#define CONFIG_DISCOVER_PHY | |
| 68 | 67 | |
| 69 | 68 | #define CONFIG_FEC_MXC |
| 70 | 69 | #define IMX_FEC_BASE FEC_BASE_ADDR |
| ... | ... | @@ -72,7 +71,7 @@ |
| 72 | 71 | #define CONFIG_PHY_ADDR CONFIG_FEC_MXC_PHYADDR |
| 73 | 72 | #define CONFIG_RESET_PHY_R |
| 74 | 73 | #define CONFIG_FEC_MXC_NO_ANEG |
| 75 | -#define CONFIG_PRIME "FEC0" | |
| 74 | +#define CONFIG_ETHPRIME "FEC0" | |
| 76 | 75 | |
| 77 | 76 | /* SPI */ |
| 78 | 77 | #define CONFIG_HARD_SPI |
include/configs/imx31_litekit.h
| ... | ... | @@ -33,7 +33,6 @@ |
| 33 | 33 | /* High Level Configuration Options */ |
| 34 | 34 | #define CONFIG_ARM1136 1 /* This is an arm1136 CPU core */ |
| 35 | 35 | #define CONFIG_MX31 1 /* in a mx31 */ |
| 36 | -#define CONFIG_MX31_HCLK_FREQ 26000000 | |
| 37 | 36 | #define CONFIG_MX31_CLK32 32000 |
| 38 | 37 | |
| 39 | 38 | #define CONFIG_DISPLAY_CPUINFO |
include/configs/imx31_phycore.h
include/configs/m28evk.h
| ... | ... | @@ -171,9 +171,9 @@ |
| 171 | 171 | #define CONFIG_LZO |
| 172 | 172 | #define CONFIG_MTD_DEVICE |
| 173 | 173 | #define CONFIG_MTD_PARTITIONS |
| 174 | -#define MTDIDS_DEFAULT "nand0=gpmi-nand.0" | |
| 174 | +#define MTDIDS_DEFAULT "nand0=gpmi-nand" | |
| 175 | 175 | #define MTDPARTS_DEFAULT \ |
| 176 | - "mtdparts=gpmi-nand.0:" \ | |
| 176 | + "mtdparts=gpmi-nand:" \ | |
| 177 | 177 | "3m(bootloader)ro," \ |
| 178 | 178 | "512k(environment)," \ |
| 179 | 179 | "512k(redundant-environment)," \ |
include/configs/mx25pdk.h
include/configs/mx28evk.h
| ... | ... | @@ -184,6 +184,9 @@ |
| 184 | 184 | #define CONFIG_EHCI_MXS_PORT 1 |
| 185 | 185 | #define CONFIG_EHCI_IS_TDI |
| 186 | 186 | #define CONFIG_USB_STORAGE |
| 187 | +#define CONFIG_USB_HOST_ETHER | |
| 188 | +#define CONFIG_USB_ETHER_ASIX | |
| 189 | +#define CONFIG_USB_ETHER_SMSC95XX | |
| 187 | 190 | #endif |
| 188 | 191 | |
| 189 | 192 | /* I2C */ |
| ... | ... | @@ -199,6 +202,7 @@ |
| 199 | 202 | #ifdef CONFIG_CMD_SPI |
| 200 | 203 | #define CONFIG_HARD_SPI |
| 201 | 204 | #define CONFIG_MXS_SPI |
| 205 | +#define CONFIG_MXS_SPI_DMA_ENABLE | |
| 202 | 206 | #define CONFIG_SPI_HALF_DUPLEX |
| 203 | 207 | #define CONFIG_DEFAULT_SPI_BUS 2 |
| 204 | 208 | #define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0 |
| ... | ... | @@ -235,7 +239,6 @@ |
| 235 | 239 | #define CONFIG_SETUP_MEMORY_TAGS |
| 236 | 240 | #define CONFIG_BOOTDELAY 3 |
| 237 | 241 | #define CONFIG_BOOTFILE "uImage" |
| 238 | -#define CONFIG_BOOTCOMMAND "run bootcmd_net" | |
| 239 | 242 | #define CONFIG_LOADADDR 0x42000000 |
| 240 | 243 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
| 241 | 244 | #define CONFIG_OF_LIBFDT |
| 242 | 245 | |
| ... | ... | @@ -244,14 +247,81 @@ |
| 244 | 247 | * Extra Environments |
| 245 | 248 | */ |
| 246 | 249 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 247 | - "console_fsl=console=ttyAM0" \ | |
| 248 | - "console_mainline=console=ttyAMA0" \ | |
| 249 | - "netargs=setenv bootargs console=${console_mainline}" \ | |
| 250 | + "update_nand_full_filename=u-boot.nand\0" \ | |
| 251 | + "update_nand_firmware_filename=u-boot.sb\0" \ | |
| 252 | + "update_sd_firmware_filename=u-boot.sd\0" \ | |
| 253 | + "update_nand_firmware_maxsz=0x100000\0" \ | |
| 254 | + "update_nand_stride=0x40\0" /* MX28 datasheet ch. 12.12 */ \ | |
| 255 | + "update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ | |
| 256 | + "update_nand_get_fcb_size=" /* Get size of FCB blocks */ \ | |
| 257 | + "nand device 0 ; " \ | |
| 258 | + "nand info ; " \ | |
| 259 | + "setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \ | |
| 260 | + "setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \ | |
| 261 | + "update_nand_full=" /* Update FCB, DBBT and FW */ \ | |
| 262 | + "if tftp ${update_nand_full_filename} ; then " \ | |
| 263 | + "run update_nand_get_fcb_size ; " \ | |
| 264 | + "nand scrub -y 0x0 ${filesize} ; " \ | |
| 265 | + "nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; " \ | |
| 266 | + "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \ | |
| 267 | + "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \ | |
| 268 | + "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ | |
| 269 | + "fi\0" \ | |
| 270 | + "update_nand_firmware=" /* Update only firmware */ \ | |
| 271 | + "if tftp ${update_nand_firmware_filename} ; then " \ | |
| 272 | + "run update_nand_get_fcb_size ; " \ | |
| 273 | + "setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \ | |
| 274 | + "setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \ | |
| 275 | + "setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \ | |
| 276 | + "nand erase ${fcb_sz} ${fw_sz} ; " \ | |
| 277 | + "nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \ | |
| 278 | + "nand write ${loadaddr} ${fw_off} ${filesize} ; " \ | |
| 279 | + "fi\0" \ | |
| 280 | + "update_sd_firmware=" /* Update the SD firmware partition */ \ | |
| 281 | + "if mmc rescan ; then " \ | |
| 282 | + "if tftp ${update_sd_firmware_filename} ; then " \ | |
| 283 | + "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ | |
| 284 | + "setexpr fw_sz ${fw_sz} + 1 ; " \ | |
| 285 | + "mmc write ${loadaddr} 0x800 ${fw_sz} ; " \ | |
| 286 | + "fi ; " \ | |
| 287 | + "fi\0" \ | |
| 288 | + "script=boot.scr\0" \ | |
| 289 | + "uimage=uImage\0" \ | |
| 290 | + "console_fsl=ttyAM0\0" \ | |
| 291 | + "console_mainline=ttyAMA0\0" \ | |
| 292 | + "mmcdev=0\0" \ | |
| 293 | + "mmcpart=2\0" \ | |
| 294 | + "mmcroot=/dev/mmcblk0p3 rw\0" \ | |
| 295 | + "mmcrootfstype=ext3 rootwait\0" \ | |
| 296 | + "mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \ | |
| 297 | + "root=${mmcroot} " \ | |
| 298 | + "rootfstype=${mmcrootfstype}\0" \ | |
| 299 | + "loadbootscript=" \ | |
| 300 | + "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ | |
| 301 | + "bootscript=echo Running bootscript from mmc ...; " \ | |
| 302 | + "source\0" \ | |
| 303 | + "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ | |
| 304 | + "mmcboot=echo Booting from mmc ...; " \ | |
| 305 | + "run mmcargs; " \ | |
| 306 | + "bootm\0" \ | |
| 307 | + "netargs=setenv bootargs console=${console_mainline},${baudrate} " \ | |
| 250 | 308 | "root=/dev/nfs " \ |
| 251 | - "ip=dhcp nfsroot=${serverip}:${nfsroot}\0" \ | |
| 252 | - "bootcmd_net=echo Booting from net ...; " \ | |
| 253 | - "run netargs; " \ | |
| 254 | - "dhcp ${uimage}; bootm\0" \ | |
| 309 | + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ | |
| 310 | + "netboot=echo Booting from net ...; " \ | |
| 311 | + "run netargs; " \ | |
| 312 | + "dhcp ${uimage}; bootm\0" | |
| 313 | + | |
| 314 | +#define CONFIG_BOOTCOMMAND \ | |
| 315 | + "if mmc rescan ${mmcdev}; then " \ | |
| 316 | + "if run loadbootscript; then " \ | |
| 317 | + "run bootscript; " \ | |
| 318 | + "else " \ | |
| 319 | + "if run loaduimage; then " \ | |
| 320 | + "run mmcboot; " \ | |
| 321 | + "else run netboot; " \ | |
| 322 | + "fi; " \ | |
| 323 | + "fi; " \ | |
| 324 | + "else run netboot; fi" | |
| 255 | 325 | |
| 256 | 326 | #endif /* __MX28EVK_CONFIG_H__ */ |
include/configs/mx31ads.h
| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | /* High Level Configuration Options */ |
| 28 | 28 | #define CONFIG_ARM1136 1 /* This is an arm1136 CPU core */ |
| 29 | 29 | #define CONFIG_MX31 1 /* in a mx31 */ |
| 30 | -#define CONFIG_MX31_HCLK_FREQ 26000000 /* RedBoot says 26MHz */ | |
| 31 | -#define CONFIG_MX31_CLK32 32768 | |
| 32 | 30 | |
| 33 | 31 | #define CONFIG_DISPLAY_CPUINFO |
| 34 | 32 | #define CONFIG_DISPLAY_BOARDINFO |
include/configs/mx31pdk.h
| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | /* High Level Configuration Options */ |
| 36 | 36 | #define CONFIG_ARM1136 /* This is an arm1136 CPU core */ |
| 37 | 37 | #define CONFIG_MX31 /* in a mx31 */ |
| 38 | -#define CONFIG_MX31_HCLK_FREQ 26000000 | |
| 39 | -#define CONFIG_MX31_CLK32 32768 | |
| 40 | 38 | |
| 41 | 39 | #define CONFIG_DISPLAY_CPUINFO |
| 42 | 40 | #define CONFIG_DISPLAY_BOARDINFO |
include/configs/mx35pdk.h
| ... | ... | @@ -31,7 +31,6 @@ |
| 31 | 31 | /* High Level Configuration Options */ |
| 32 | 32 | #define CONFIG_ARM1136 /* This is an arm1136 CPU core */ |
| 33 | 33 | #define CONFIG_MX35 |
| 34 | -#define CONFIG_MX35_HCLK_FREQ 24000000 | |
| 35 | 34 | |
| 36 | 35 | #define CONFIG_DISPLAY_CPUINFO |
| 37 | 36 | |
| ... | ... | @@ -111,6 +110,12 @@ |
| 111 | 110 | #define CONFIG_NET_RETRY_COUNT 100 |
| 112 | 111 | #define CONFIG_CMD_DATE |
| 113 | 112 | |
| 113 | +#define CONFIG_CMD_MMC | |
| 114 | +#define CONFIG_DOS_PARTITION | |
| 115 | +#define CONFIG_EFI_PARTITION | |
| 116 | +#define CONFIG_CMD_EXT2 | |
| 117 | +#define CONFIG_CMD_FAT | |
| 118 | + | |
| 114 | 119 | #define CONFIG_BOOTDELAY 3 |
| 115 | 120 | |
| 116 | 121 | #define CONFIG_LOADADDR 0x80800000 /* loadaddr env var */ |
| ... | ... | @@ -238,6 +243,13 @@ |
| 238 | 243 | #define CONFIG_MXC_NAND_HWECC |
| 239 | 244 | #define CONFIG_SYS_NAND_LARGEPAGE |
| 240 | 245 | |
| 246 | +/* mmc driver */ | |
| 247 | +#define CONFIG_MMC | |
| 248 | +#define CONFIG_GENERIC_MMC | |
| 249 | +#define CONFIG_FSL_ESDHC | |
| 250 | +#define CONFIG_SYS_FSL_ESDHC_ADDR 0 | |
| 251 | +#define CONFIG_SYS_FSL_ESDHC_NUM 1 | |
| 252 | + | |
| 241 | 253 | /* |
| 242 | 254 | * Default environment and default scripts |
| 243 | 255 | * to update uboot and load kernel |
| ... | ... | @@ -279,8 +291,8 @@ |
| 279 | 291 | "u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.bin\0" \ |
| 280 | 292 | "load=tftp ${loadaddr} ${u-boot}\0" \ |
| 281 | 293 | "uboot_addr=" xstr(CONFIG_SYS_MONITOR_BASE) "\0" \ |
| 282 | - "update=protect off ${uboot_addr} +40000;" \ | |
| 283 | - "erase ${uboot_addr} +40000;" \ | |
| 294 | + "update=protect off ${uboot_addr} +80000;" \ | |
| 295 | + "erase ${uboot_addr} +80000;" \ | |
| 284 | 296 | "cp.b ${loadaddr} ${uboot_addr} ${filesize}\0" \ |
| 285 | 297 | "upd=if run load;then echo Updating u-boot;if run update;" \ |
| 286 | 298 | "then echo U-Boot updated;" \ |
include/configs/qong.h
| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | #define CONFIG_ARM1136 /* This is an arm1136 CPU core */ |
| 29 | 29 | #define CONFIG_MX31 /* in a mx31 */ |
| 30 | 30 | #define CONFIG_QONG |
| 31 | -#define CONFIG_MX31_HCLK_FREQ 26000000 /* 26MHz */ | |
| 32 | -#define CONFIG_MX31_CLK32 32768 | |
| 33 | 31 | |
| 34 | 32 | #define CONFIG_DISPLAY_CPUINFO |
| 35 | 33 | #define CONFIG_DISPLAY_BOARDINFO |
include/configs/sc_sps_1.h
include/configs/tt01.h
include/configs/zmx25.h