* [PATCH 2/4] PCM038: Call power_init() after initializing SPI.
2012-05-13 5:38 [PATCH 1/4] PCM038: Update board description Alexander Shiyan
@ 2012-05-13 5:38 ` Alexander Shiyan
2012-05-13 5:38 ` [PATCH 3/4] PCM038: Remove unused includes Alexander Shiyan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2012-05-13 5:38 UTC (permalink / raw)
To: barebox
Power and frequency should be setup before initialize other devices.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/boards/pcm038/pcm038.c | 140 +++++++++++++++++---------------------
1 files changed, 63 insertions(+), 77 deletions(-)
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index d481bdc..7814244 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -131,6 +131,67 @@ static void pcm038_usbh_init(void)
}
#endif
+/**
+ * The spctl0 register is a beast: Seems you can read it
+ * only one times without writing it again.
+ */
+static inline uint32_t get_pll_spctl10(void)
+{
+ uint32_t reg;
+
+ reg = SPCTL0;
+ SPCTL0 = reg;
+
+ return reg;
+}
+
+/**
+ * If the PLL settings are in place switch the CPU core frequency to the max. value
+ */
+static int pcm038_power_init(void)
+{
+#ifdef CONFIG_MFD_MC13XXX
+ uint32_t spctl0 = get_pll_spctl10();
+ struct mc13xxx *mc13xxx = mc13xxx_get();
+
+ /* PLL registers already set to their final values? */
+ if (spctl0 == SPCTL0_VAL && MPCTL0 == MPCTL0_VAL) {
+ console_flush();
+ if (mc13xxx) {
+ mc13xxx_reg_write(mc13xxx, MC13783_REG_SWITCHERS(0),
+ MC13783_SWX_VOLTAGE(MC13783_SWX_VOLTAGE_1_450) |
+ MC13783_SWX_VOLTAGE_DVS(MC13783_SWX_VOLTAGE_1_450) |
+ MC13783_SWX_VOLTAGE_STANDBY(MC13783_SWX_VOLTAGE_1_450));
+
+ mc13xxx_reg_write(mc13xxx, MC13783_REG_SWITCHERS(4),
+ MC13783_SW1A_MODE(MC13783_SWX_MODE_NO_PULSE_SKIP) |
+ MC13783_SW1A_MODE_STANDBY(MC13783_SWX_MODE_NO_PULSE_SKIP) |
+ MC13783_SW1A_SOFTSTART |
+ MC13783_SW1B_MODE(MC13783_SWX_MODE_NO_PULSE_SKIP) |
+ MC13783_SW1B_MODE_STANDBY(MC13783_SWX_MODE_NO_PULSE_SKIP) |
+ MC13783_SW1B_SOFTSTART |
+ MC13783_SW_PLL_FACTOR(32));
+
+ /* wait for required power level to run the CPU at 400 MHz */
+ udelay(100000);
+ CSCR = CSCR_VAL_FINAL;
+ PCDR0 = 0x130410c3;
+ PCDR1 = 0x09030911;
+
+ /* Clocks have changed. Notify clients */
+ clock_notifier_call_chain();
+ } else {
+ printf("Failed to initialize PMIC. Will continue with low CPU speed\n");
+ }
+ }
+#endif
+
+ /* clock gating enable */
+ GPCR = 0x00050f08;
+
+ return 0;
+}
+
static int pcm038_mem_init(void)
{
arm_add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024);
@@ -245,6 +306,8 @@ static int pcm038_devices_init(void)
spi_register_board_info(pcm038_spi_board_info, ARRAY_SIZE(pcm038_spi_board_info));
imx27_add_spi0(&pcm038_spi_0_data);
+ pcm038_power_init();
+
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
imx27_add_nand(&nand_info);
imx27_add_fb(&pcm038_fb_data);
@@ -305,80 +368,3 @@ static int pcm038_console_init(void)
}
console_initcall(pcm038_console_init);
-
-#ifdef CONFIG_MFD_MC13XXX
-static int pmic_power(void)
-{
- struct mc13xxx *mc13xxx;
-
- mc13xxx = mc13xxx_get();
- if (!mc13xxx)
- return -ENODEV;
-
- mc13xxx_reg_write(mc13xxx, MC13783_REG_SWITCHERS(0),
- MC13783_SWX_VOLTAGE(MC13783_SWX_VOLTAGE_1_450) |
- MC13783_SWX_VOLTAGE_DVS(MC13783_SWX_VOLTAGE_1_450) |
- MC13783_SWX_VOLTAGE_STANDBY(MC13783_SWX_VOLTAGE_1_450));
-
- mc13xxx_reg_write(mc13xxx, MC13783_REG_SWITCHERS(4),
- MC13783_SW1A_MODE(MC13783_SWX_MODE_NO_PULSE_SKIP) |
- MC13783_SW1A_MODE_STANDBY(MC13783_SWX_MODE_NO_PULSE_SKIP) |
- MC13783_SW1A_SOFTSTART |
- MC13783_SW1B_MODE(MC13783_SWX_MODE_NO_PULSE_SKIP) |
- MC13783_SW1B_MODE_STANDBY(MC13783_SWX_MODE_NO_PULSE_SKIP) |
- MC13783_SW1B_SOFTSTART |
- MC13783_SW_PLL_FACTOR(32));
-
- return 0;
-}
-#else
-# define pmic_power() (1)
-#endif
-
-/**
- * The spctl0 register is a beast: Seems you can read it
- * only one times without writing it again.
- */
-static inline uint32_t get_pll_spctl10(void)
-{
- uint32_t reg;
-
- reg = SPCTL0;
- SPCTL0 = reg;
-
- return reg;
-}
-
-/**
- * If the PLL settings are in place switch the CPU core frequency to the max. value
- */
-static int pcm038_power_init(void)
-{
- uint32_t spctl0;
-
- spctl0 = get_pll_spctl10();
-
- /* PLL registers already set to their final values? */
- if (spctl0 == SPCTL0_VAL && MPCTL0 == MPCTL0_VAL) {
- console_flush();
- if (!pmic_power()) {
- /* wait for required power level to run the CPU at 400 MHz */
- udelay(100000);
- CSCR = CSCR_VAL_FINAL;
- PCDR0 = 0x130410c3;
- PCDR1 = 0x09030911;
- /* Clocks have changed. Notify clients */
- clock_notifier_call_chain();
- } else {
- printf("Failed to initialize PMIC. Will continue with low CPU speed\n");
- }
- }
-
- /* clock gating enable */
- GPCR = 0x00050f08;
-
- return 0;
-}
-
-late_initcall(pcm038_power_init);
-
--
1.7.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] PCM038: Remove unused includes
2012-05-13 5:38 [PATCH 1/4] PCM038: Update board description Alexander Shiyan
2012-05-13 5:38 ` [PATCH 2/4] PCM038: Call power_init() after initializing SPI Alexander Shiyan
@ 2012-05-13 5:38 ` Alexander Shiyan
2012-05-13 5:38 ` [PATCH 4/4] PCM038: Initial PCM970 development board support Alexander Shiyan
2012-05-13 9:13 ` [PATCH 1/4] PCM038: Update board description Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2012-05-13 5:38 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/boards/pcm038/pcm038.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 7814244..4f0a60a 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -30,15 +30,12 @@
#include <generated/mach-types.h>
#include <partition.h>
#include <fs.h>
-#include <fcntl.h>
#include <nand.h>
-#include <command.h>
#include <spi/spi.h>
#include <io.h>
#include <mach/imx-nand.h>
#include <mach/imx-pll.h>
#include <mach/imxfb.h>
-#include <asm/mmu.h>
#include <i2c/i2c.h>
#include <usb/ulpi.h>
#include <mach/spi.h>
--
1.7.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] PCM038: Initial PCM970 development board support
2012-05-13 5:38 [PATCH 1/4] PCM038: Update board description Alexander Shiyan
2012-05-13 5:38 ` [PATCH 2/4] PCM038: Call power_init() after initializing SPI Alexander Shiyan
2012-05-13 5:38 ` [PATCH 3/4] PCM038: Remove unused includes Alexander Shiyan
@ 2012-05-13 5:38 ` Alexander Shiyan
2012-05-13 9:13 ` [PATCH 1/4] PCM038: Update board description Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2012-05-13 5:38 UTC (permalink / raw)
To: barebox
Some devices need to be moved to the PCM970 source file later, because
in fact these devices are not installed on the main unit PCM038.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/boards/pcm038/Makefile | 5 ++---
arch/arm/boards/pcm038/pcm038.c | 3 ---
arch/arm/boards/pcm038/pcm970.c | 30 ++++++++++++++++++++++++++++++
arch/arm/mach-imx/Kconfig | 8 ++++++++
4 files changed, 40 insertions(+), 6 deletions(-)
create mode 100644 arch/arm/boards/pcm038/pcm970.c
diff --git a/arch/arm/boards/pcm038/Makefile b/arch/arm/boards/pcm038/Makefile
index 970804e..6cd3a5b 100644
--- a/arch/arm/boards/pcm038/Makefile
+++ b/arch/arm/boards/pcm038/Makefile
@@ -1,3 +1,2 @@
-
-obj-y += lowlevel.o
-obj-y += pcm038.o
+obj-y += lowlevel.o pcm038.o
+obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970.o
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 4f0a60a..db60f2c 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -287,9 +287,6 @@ static int pcm038_devices_init(void)
/* configure SRAM on cs1 */
imx27_setup_weimcs(1, 0x0000d843, 0x22252521, 0x22220a00);
- /* configure SJA1000 on cs4 */
- imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
-
/* initizalize gpios */
for (i = 0; i < ARRAY_SIZE(mode); i++)
imx_gpio_mode(mode[i]);
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
new file mode 100644
index 0000000..cdd68a3
--- /dev/null
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -0,0 +1,30 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <io.h>
+#include <init.h>
+#include <mach/imx-regs.h>
+
+static int pcm970_init(void)
+{
+ /* Configure SJA1000 on cs4 */
+ imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
+
+ return 0;
+}
+
+late_initcall(pcm970_init);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3236762..b402677 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -294,6 +294,14 @@ config MACH_PCM038
Say Y here if you are using Phytec's phyCORE-i.MX27 (pcm038) equipped
with a Freescale i.MX27 Processor
+config MACH_PCM970_BASEBOARD
+ bool "PHYTEC PCM970 development board"
+ depends on MACH_PCM038
+ default y
+ help
+ This adds board specific devices that can be found on Phytec's
+ PCM970 evaluation board.
+
config MACH_NESO
bool "Garz+Fricke Neso"
select MACH_HAS_LOWLEVEL_INIT
--
1.7.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] PCM038: Update board description
2012-05-13 5:38 [PATCH 1/4] PCM038: Update board description Alexander Shiyan
` (2 preceding siblings ...)
2012-05-13 5:38 ` [PATCH 4/4] PCM038: Initial PCM970 development board support Alexander Shiyan
@ 2012-05-13 9:13 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-05-13 9:13 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sun, May 13, 2012 at 09:38:02AM +0400, Alexander Shiyan wrote:
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Applied, thanks
Sascha
> ---
> arch/arm/boards/pcm038/pcm038.dox | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boards/pcm038/pcm038.dox b/arch/arm/boards/pcm038/pcm038.dox
> index 9b17674..85177d2 100644
> --- a/arch/arm/boards/pcm038/pcm038.dox
> +++ b/arch/arm/boards/pcm038/pcm038.dox
> @@ -2,7 +2,8 @@
>
> This CPU card is based on a Freescale i.MX27 CPU. The card is shipped with:
>
> -- up to 32MiB NOR type Flash Memory
> -- 32MiB synchronous dynamic RAM
> +- up to 64MB NOR Flash Memory
> +- up to 1GB NAND Flash Memory
> +- up to 256MB DRAM
>
> */
> --
> 1.7.3.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread