Skip to contentSkip to conversation

ARM: OMAP: AM33xx: Add basic NAND support

PATCH In review Teresa Gámez 2 participants 15 messages Jul 9, 2013 – Jul 10, 2013

Subsystems (5)
lore
Share & tools
lore
#2 lore raw

PATCH v2 3/12 ARM: AM33xx: Add gpio support

In reply to Teresa Gámez

Register GPIO banks for AM33xx boards.

---
 arch/arm/mach-omap/am33xx_generic.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-omap/am33xx_generic.c +14 -0
index 9806fbe..ac99035 100644
@@ -141,3 +141,17 @@ const struct gpmc_config am33xx_nand_cfg = {
 	.base = 0x08000000,
 	.size = GPMC_SIZE_16M,
 };
+
+static int am33xx_gpio_init(void)
+{
+	add_generic_device("omap-gpio", 0, NULL, AM33XX_GPIO0_BASE,
+				0xf00, IORESOURCE_MEM, NULL);
+	add_generic_device("omap-gpio", 1, NULL, AM33XX_GPIO1_BASE,
+				0xf00, IORESOURCE_MEM, NULL);
+	add_generic_device("omap-gpio", 2, NULL, AM33XX_GPIO2_BASE,
+				0xf00, IORESOURCE_MEM, NULL);
+	add_generic_device("omap-gpio", 3, NULL, AM33XX_GPIO3_BASE,
+				0xf00, IORESOURCE_MEM, NULL);
+	return 0;
+}
+coredevice_initcall(am33xx_gpio_init);
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw

PATCH v2 12/12 PCM051: Pass barebox partition information

In reply to Teresa Gámez

pcm051 uses four MLO NAND partitions, so the default offset to the barebox can not be used. Pass custom struct.

---
 arch/arm/boards/pcm051/board.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/boards/pcm051/board.c +9 -0
index 6ef1f4b..1993f34 100644
@@ -32,6 +32,7 @@
 #include <mach/am33xx-mux.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/cpsw.h>
+#include <mach/generic.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
 #include <spi/spi.h>
@@ -121,6 +122,13 @@ static struct gpmc_nand_platform_data nand_plat = {
 	.nand_cfg = &pcm051_nand_cfg,
 };
 
+static struct omap_barebox_part pcm051_barebox_part = {
+	.nand_offset = SZ_512K,
+	.nand_size = SZ_512K,
+	.nor_offset = SZ_128K,
+	.nor_size = SZ_512K,
+};
+
 static void pcm051_spi_init(void)
 {
 	int ret;
@@ -197,6 +205,7 @@ static int pcm051_devices_init(void)
 		break;
 	}
 
+	omap_set_barebox_part(&pcm051_barebox_part);
 	armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
 	armlinux_set_architecture(MACH_TYPE_PCM051);
 
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#0 lore raw

PATCH v2 1/12 ARM: OMAP: AM33xx: Add basic NAND support

---
 arch/arm/mach-omap/am33xx_generic.c          |   15 +++++++++++++++
 arch/arm/mach-omap/am33xx_mux.c              |    8 +++++---
 arch/arm/mach-omap/include/mach/am33xx-mux.h |    1 +
 arch/arm/mach-omap/include/mach/gpmc_nand.h  |    1 +
 4 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/mach-omap/am33xx_generic.c +15 -0
index 96432c9..9806fbe 100644
@@ -27,6 +27,7 @@
 #include <mach/am33xx-clock.h>
 #include <mach/sys_info.h>
 #include <mach/am33xx-generic.h>
+#include <mach/gpmc.h>
 
 void __noreturn reset_cpu(unsigned long addr)
 {
@@ -126,3 +127,17 @@ int am33xx_register_ethaddr(int eth_id, int mac_id)
 
 	return -ENODEV;
 }
+
+/* GPMC timing for AM33XX nand device */
+const struct gpmc_config am33xx_nand_cfg = {
+	.cfg = {
+		0x00000800,	/* CONF1 */
+		0x001e1e00,	/* CONF2 */
+		0x001e1e00,	/* CONF3 */
+		0x16051807,	/* CONF4 */
+		0x00151e1e,	/* CONF5 */
+		0x16000f80,	/* CONF6 */
+	},
+	.base = 0x08000000,
+	.size = GPMC_SIZE_16M,
+};
arch/arm/mach-omap/am33xx_mux.c +5 -3
index abc8586..8318713 100644
@@ -39,8 +39,6 @@ static const __maybe_unused struct module_pin_mux uart3_pin_mux[] = {
 	{-1},
 };
 
-
-#ifdef CONFIG_NAND
 static const __maybe_unused struct module_pin_mux nand_pin_mux[] = {
 	{OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)},	/* NAND AD0 */
 	{OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)},	/* NAND AD1 */
@@ -59,7 +57,6 @@ static const __maybe_unused struct module_pin_mux nand_pin_mux[] = {
 	{OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)},	/* NAND_BE_CLE */
 	{-1},
 };
-#endif
 
 static const __maybe_unused struct module_pin_mux i2c0_pin_mux[] = {
 	{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},	/* I2C_DATA */
@@ -319,3 +316,8 @@ void am33xx_enable_spi0_pin_mux(void)
 {
 	configure_module_pin_mux(spi0_pin_mux);
 }
+
+void am33xx_enable_nand_pin_mux(void)
+{
+	configure_module_pin_mux(nand_pin_mux);
+}
arch/arm/mach-omap/include/mach/am33xx-mux.h +1 -0
index d6b19dd..fe3168b 100644
@@ -257,5 +257,6 @@ extern void am33xx_enable_uart0_pin_mux(void);
 extern void am33xx_enable_uart2_pin_mux(void);
 extern void am33xx_enable_mmc0_pin_mux(void);
 extern void am33xx_enable_spi0_pin_mux(void);
+extern void am33xx_enable_nand_pin_mux(void);
 
 #endif /*__AM33XX_MUX_H__ */
arch/arm/mach-omap/include/mach/gpmc_nand.h +1 -0
index 4a93465..8d138ec 100644
@@ -65,5 +65,6 @@ int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata);
 
 extern struct gpmc_config omap3_nand_cfg;
 extern struct gpmc_config omap4_nand_cfg;
+extern struct gpmc_config am33xx_nand_cfg;
 
 #endif				/* __ASM_OMAP_NAND_GPMC_H */
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 5/12 PCM051: Update pcm051_defconfig

---
 arch/arm/configs/pcm051_defconfig |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
arch/arm/configs/pcm051_defconfig +13 -2
index e90e27f..0bc7c90 100644
@@ -1,11 +1,15 @@
 CONFIG_ARCH_OMAP=y
 CONFIG_ARCH_AM33XX=y
-CONFIG_OMAP_BUILD_IFT=y
 CONFIG_MACH_PCM051=y
+CONFIG_OMAP_UART1=y
 CONFIG_AEABI=y
+CONFIG_ARM_BOARD_APPEND_ATAG=y
+CONFIG_CMD_ARM_MMUINFO=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
-CONFIG_TEXT_BASE=0x81000000
+CONFIG_MMU=y
+CONFIG_TEXT_BASE=0x8f000000
+CONFIG_MALLOC_SIZE=0x2000000
 CONFIG_PROMPT="barebox@pcm051>"
 CONFIG_LONGHELP=y
 CONFIG_HUSH_FANCY_PROMPT=y
@@ -27,6 +31,8 @@ CONFIG_CMD_PRINTENV=y
 CONFIG_CMD_READLINE=y
 CONFIG_CMD_MENU=y
 CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_TFTP=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_CRC=y
@@ -39,11 +45,13 @@ CONFIG_CMD_UIMAGE=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_RESET=y
 CONFIG_CMD_GO=y
+CONFIG_CMD_BAREBOX_UPDATE=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_UNCOMPRESS=y
 CONFIG_CMD_I2C=y
+CONFIG_CMD_SPI=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_NFS=y
@@ -64,6 +72,9 @@ CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_OMAP_HSMMC=y
 CONFIG_EEPROM_AT24=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/12 PCM051: Add basic nand support

In reply to Teresa Gámez

Add basic NAND support for pcm051.

---
 arch/arm/boards/pcm051/board.c                |   54 +++++++++++++++++++++++-
 arch/arm/boards/pcm051/env/boot/nand-ubi      |   10 +++++
 arch/arm/boards/pcm051/env/init/mtdparts-nand |   11 +++++
 arch/arm/configs/pcm051_defconfig             |    3 +
 4 files changed, 75 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/env/boot/nand-ubi
 create mode 100644 arch/arm/boards/pcm051/env/init/mtdparts-nand
arch/arm/boards/pcm051/board.c +51 -3
index eea5ebb..db371e5 100644
@@ -17,9 +17,11 @@
  *
  */
 
+#include <bootsource.h>
 #include <common.h>
 #include <init.h>
 #include <io.h>
+#include <nand.h>
 #include <sizes.h>
 #include <ns16550.h>
 #include <asm/armlinux.h>
@@ -30,6 +32,8 @@
 #include <mach/am33xx-mux.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/cpsw.h>
+#include <mach/gpmc.h>
+#include <mach/gpmc_nand.h>
 #include <spi/spi.h>
 #include <spi/flash.h>
 #include <i2c/i2c.h>
@@ -97,6 +101,25 @@ static struct i2c_board_info i2c0_devices[] = {
 	},
 };
 
+static struct gpmc_config pcm051_nand_cfg = {
+	.cfg = {
+		0x00000800,	/* CONF1 */
+		0x00030300,	/* CONF2 */
+		0x00030300,	/* CONF3 */
+		0x02000311,	/* CONF4 */
+		0x00030303,	/* CONF5 */
+		0x03000540,	/* CONF6 */
+	},
+	.base = 0x08000000,
+	.size = GPMC_SIZE_16M,
+};
+
+static struct gpmc_nand_platform_data nand_plat = {
+	.wait_mon_pin = 1,
+	.ecc_mode = OMAP_ECC_BCH8_CODE_HW,
+	.nand_cfg = &pcm051_nand_cfg,
+};
+
 static void pcm051_spi_init(void)
 {
 	int ret;
@@ -128,6 +151,15 @@ static void pcm051_i2c_init(void)
 	am33xx_add_i2c0(NULL);
 }
 
+static void pcm051_nand_init(void)
+{
+	am33xx_enable_nand_pin_mux();
+
+	gpmc_generic_init(0x12);
+
+	omap_add_gpmc_nand_device(&nand_plat);
+}
+
 static int pcm051_devices_init(void)
 {
 	pcm051_enable_mmc0_pin_mux();
@@ -137,13 +169,29 @@ static int pcm051_devices_init(void)
 	pcm051_spi_init();
 	pcm051_eth_init();
 	pcm051_i2c_init();
+	pcm051_nand_init();
 
-	devfs_add_partition("nor0", 0x00000, SZ_128K,
+	switch (bootsource_get()) {
+	case BOOTSOURCE_SPI:
+		devfs_add_partition("nor0", 0x00000, SZ_128K,
 					DEVFS_PARTITION_FIXED, "xload");
-	devfs_add_partition("nor0", SZ_128K, SZ_512K,
+		devfs_add_partition("nor0", SZ_128K, SZ_512K,
 					DEVFS_PARTITION_FIXED, "self0");
-	devfs_add_partition("nor0", SZ_128K + SZ_512K, SZ_128K,
+		devfs_add_partition("nor0", SZ_128K + SZ_512K, SZ_128K,
 					DEVFS_PARTITION_FIXED, "env0");
+		break;
+	default:
+		devfs_add_partition("nand0", 0x00000, SZ_128K,
+					DEVFS_PARTITION_FIXED, "xload_raw");
+		dev_add_bb_dev("xload_raw", "xload");
+		devfs_add_partition("nand0", SZ_512K, SZ_512K,
+					DEVFS_PARTITION_FIXED, "self_raw");
+		dev_add_bb_dev("self_raw", "self0");
+		devfs_add_partition("nand0", SZ_512K + SZ_512K, SZ_128K,
+					DEVFS_PARTITION_FIXED, "env_raw");
+		dev_add_bb_dev("env_raw", "env0");
+		break;
+	}
 
 	armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
 	armlinux_set_architecture(MACH_TYPE_PCM051);
arch/arm/boards/pcm051/env/boot/nand-ubi new file +10 -0
new file mode 100644
index 0000000..efea518
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+	boot-menu-add-entry "$0" "nand (UBI)"
+	exit
+fi
+
+global.bootm.image="/dev/nand0.kernel.bb"
+#global.bootm.oftree="/env/oftree"
+bootargs-root-ubi -r root -m nand0.root,2048
arch/arm/boards/pcm051/env/init/mtdparts-nand new file +11 -0
new file mode 100644
index 0000000..12f0ffd
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+	init-menu-add-entry "$0" "NAND partitions"
+	exit
+fi
+
+mtdparts="128k(nand0.xload),128k(nand0.xload_backup1),128k(nand0.xload_backup2),128k(nand0.xload_backup3),512k(nand0.barebox)ro,128k(nand0.bareboxenv),8M(nand0.kernel),-(nand0.root)"
+kernelname="omap2-nand.0"
+
+mtdparts-add -b -d nand0 -k ${kernelname} -p ${mtdparts}
arch/arm/configs/pcm051_defconfig +3 -0
index 8de3714..e90e27f 100644
@@ -33,6 +33,7 @@ CONFIG_CMD_CRC=y
 CONFIG_CMD_CRC_CMP=y
 CONFIG_CMD_MD5SUM=y
 CONFIG_CMD_FLASH=y
+CONFIG_CMD_UBIFORMAT=y
 CONFIG_CMD_BOOTM_SHOW_TYPE=y
 CONFIG_CMD_UIMAGE=y
 CONFIG_CMD_BOOTZ=y
@@ -56,6 +57,8 @@ CONFIG_I2C_OMAP=y
 CONFIG_MTD=y
 CONFIG_MTD_M25P80=y
 CONFIG_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_UBI=y
 CONFIG_USB=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 7/12 ARM: AM33xx: Enable clock for all GPIO banks

In reply to Teresa Gámez
---
 arch/arm/mach-omap/am33xx_clock.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-omap/am33xx_clock.c +12 -0
index 4451d62..e4d9d77 100644
@@ -53,6 +53,18 @@ static void interface_clocks_enable(void)
 	/* GPIO0 */
 	__raw_writel(PRCM_MOD_EN, CM_WKUP_GPIO0_CLKCTRL);
 	while (__raw_readl(CM_WKUP_GPIO0_CLKCTRL) != PRCM_MOD_EN);
+
+	/* GPIO1 */
+	__raw_writel(PRCM_MOD_EN, CM_PER_GPIO1_CLKCTRL);
+	while (__raw_readl(CM_PER_GPIO1_CLKCTRL) != PRCM_MOD_EN);
+
+	/* GPIO2 */
+	__raw_writel(PRCM_MOD_EN, CM_PER_GPIO2_CLKCTRL);
+	while (__raw_readl(CM_PER_GPIO2_CLKCTRL) != PRCM_MOD_EN);
+
+	/* GPIO3 */
+	__raw_writel(PRCM_MOD_EN, CM_PER_GPIO3_CLKCTRL);
+	while (__raw_readl(CM_PER_GPIO3_CLKCTRL) != PRCM_MOD_EN);
 }
 
 static void power_domain_transition_enable(void)
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 4/12 PCM051: Add muxing for user led and btn

In reply to Teresa Gámez
---
 arch/arm/boards/pcm051/board.c |    3 +++
 arch/arm/boards/pcm051/mux.c   |   22 ++++++++++++++++++++++
 arch/arm/boards/pcm051/mux.h   |    2 ++
 3 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/boards/pcm051/board.c +3 -0
index db371e5..cb8c1d9 100644
@@ -171,6 +171,9 @@ static int pcm051_devices_init(void)
 	pcm051_i2c_init();
 	pcm051_nand_init();
 
+	pcm051_enable_user_led_pin_mux();
+	pcm051_enable_user_btn_pin_mux();
+
 	switch (bootsource_get()) {
 	case BOOTSOURCE_SPI:
 		devfs_add_partition("nor0", 0x00000, SZ_128K,
arch/arm/boards/pcm051/mux.c +22 -0
index b8fb669..6ef5af1 100644
@@ -14,7 +14,29 @@ static const struct module_pin_mux mmc0_pin_mux[] = {
 	{-1},
 };
 
+static const struct module_pin_mux user_led_pin_mux[] = {
+	{OFFSET(gpmc_csn1), MODE(7) | PULLUDEN}, /* USER LED1 */
+	{OFFSET(gpmc_csn2), MODE(7) | PULLUDEN}, /* USER LED2 */
+	{-1},
+};
+
+static const struct module_pin_mux user_btn_pin_mux[] = {
+	{OFFSET(emu0), MODE(7) | RXACTIVE | PULLUP_EN},
+	{OFFSET(emu1), MODE(7) | RXACTIVE | PULLUP_EN},
+	{-1},
+};
+
 void pcm051_enable_mmc0_pin_mux(void)
 {
 	configure_module_pin_mux(mmc0_pin_mux);
 }
+
+void pcm051_enable_user_led_pin_mux(void)
+{
+	configure_module_pin_mux(user_led_pin_mux);
+}
+
+void pcm051_enable_user_btn_pin_mux(void)
+{
+	configure_module_pin_mux(user_btn_pin_mux);
+}
arch/arm/boards/pcm051/mux.h +2 -0
index f35bc9e..4008376 100644
@@ -1 +1,3 @@
 extern void pcm051_enable_mmc0_pin_mux(void);
+extern void pcm051_enable_user_led_pin_mux(void);
+extern void pcm051_enable_user_btn_pin_mux(void);
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH v2 9/12 ARM: AM33xx: Make mpu pll configurable by lowlevel board code

In reply to Teresa Gámez
---
 arch/arm/boards/beaglebone/lowlevel.c          |    2 +-
 arch/arm/boards/pcm051/lowlevel.c              |    2 +-
 arch/arm/mach-omap/am33xx_clock.c              |    4 ++--
 arch/arm/mach-omap/include/mach/am33xx-clock.h |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boards/beaglebone/lowlevel.c +1 -1
index 28959ff..65d0887 100644
@@ -197,7 +197,7 @@ void beaglebone_sram_init(void)
 	u32 regVal, uart_base;
 
 	/* Setup the PLLs and the clocks for the peripherals */
-	pll_init();
+	pll_init(MPUPLL_M_500);
 
 	beaglebone_config_ddr();
 
arch/arm/boards/pcm051/lowlevel.c +1 -1
index 44c5a3a..7e7633c 100644
@@ -158,7 +158,7 @@ void pcm051_sram_init(void)
 	u32 regVal, uart_base;
 
 	/* Setup the PLLs and the clocks for the peripherals */
-	pll_init();
+	pll_init(MPUPLL_M_600);
 
 	pcm051_config_ddr();
 
arch/arm/mach-omap/am33xx_clock.c +2 -2
index e4d9d77..9928e9f 100644
@@ -294,9 +294,9 @@ void enable_ddr_clocks(void)
 /*
  * Configure the PLL/PRCM for necessary peripherals
  */
-void pll_init()
+void pll_init(int mpupll_M)
 {
-	mpu_pll_config(MPUPLL_M_500);
+	mpu_pll_config(mpupll_M);
 	core_pll_config();
 	per_pll_config();
 	ddr_pll_config();
arch/arm/mach-omap/include/mach/am33xx-clock.h +1 -1
index 3d1f074..968509e 100644
@@ -187,7 +187,7 @@
 
 #define CM_ALWON_GPMC_CLKCTRL           CM_PER_GPMC_CLKCTRL
 
-extern void pll_init(void);
+extern void pll_init(int mpupll_M);
 extern void enable_ddr_clocks(void);
 
 #endif  /* endif _AM33XX_CLOCKS_H_ */
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 6/12 PCM051: Rename SPI NOR device

In reply to Teresa Gámez

Renamed SPI NOR device from nor0 to m25p0,
to make booting from it possible.

---
 arch/arm/boards/pcm051/board.c               |    8 ++++----
 arch/arm/boards/pcm051/env/boot/spi-nor      |    2 +-
 arch/arm/boards/pcm051/env/init/mtdparts-nor |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/boards/pcm051/board.c +4 -4
index cb8c1d9..8701596 100644
@@ -65,7 +65,7 @@ static int pcm051_mem_init(void)
 mem_initcall(pcm051_mem_init);
 
 static struct flash_platform_data pcm051_spi_flash = {
-	.name	= "nor",
+	.name	= "m25p",
 	.type	= "w25q64",
 };
 
@@ -176,11 +176,11 @@ static int pcm051_devices_init(void)
 
 	switch (bootsource_get()) {
 	case BOOTSOURCE_SPI:
-		devfs_add_partition("nor0", 0x00000, SZ_128K,
+		devfs_add_partition("m25p0", 0x00000, SZ_128K,
 					DEVFS_PARTITION_FIXED, "xload");
-		devfs_add_partition("nor0", SZ_128K, SZ_512K,
+		devfs_add_partition("m25p0", SZ_128K, SZ_512K,
 					DEVFS_PARTITION_FIXED, "self0");
-		devfs_add_partition("nor0", SZ_128K + SZ_512K, SZ_128K,
+		devfs_add_partition("m25p0", SZ_128K + SZ_512K, SZ_128K,
 					DEVFS_PARTITION_FIXED, "env0");
 		break;
 	default:
arch/arm/boards/pcm051/env/boot/spi-nor +1 -1
index d5f77c8..9273b84 100644
@@ -5,7 +5,7 @@ if [ "$1" = menu ]; then
         exit
 fi
 
-global.bootm.image="/dev/nor0.kernel"
+global.bootm.image="/dev/m25p0.kernel"
 
 # Use rootfs form SD-Card for now as rootfs partition < 4MB
 global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
arch/arm/boards/pcm051/env/init/mtdparts-nor +2 -2
index 91aa847..5c762ad 100644
@@ -5,8 +5,8 @@ if [ "$1" = menu ]; then
 	exit
 fi
 
-mtdparts="128k(nor0.xload),512k(nor0.barebox),128k(nor0.bareboxenv),4M(nor0.kernel),-(nor0.root)"
+mtdparts="128k(m25p0.xload),512k(m25p0.barebox),128k(m25p0.bareboxenv),4M(m25p0.kernel),-(m25p0.root)"
 kernelname="spi_flash"
 
-mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}
+mtdparts-add -d m25p0 -k ${kernelname} -p ${mtdparts}
 
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

PATCH v2 11/12 ARM OMAP: get barebox partion information from boardcode

In reply to Teresa Gámez

The size and offset of the barebox partition in nand and spi nor flash may vary on different boards. Make it possible to pass this information over boardfile if needed.

---
 arch/arm/mach-omap/include/mach/generic.h |   16 ++++++++++++
 arch/arm/mach-omap/xload.c                |   38 +++++++++++++++++++++++-----
 2 files changed, 47 insertions(+), 7 deletions(-)
arch/arm/mach-omap/include/mach/generic.h +16 -0
index 9c474e2..3314faf 100644
@@ -33,6 +33,22 @@
 #define cpu_is_am33xx()		(0)
 #endif
 
+struct omap_barebox_part {
+	unsigned int nand_offset;
+	unsigned int nand_size;
+	unsigned int nor_offset;
+	unsigned int nor_size;
+};
+
+#ifdef CONFIG_SHELL_NONE
+int omap_set_barebox_part(struct omap_barebox_part *part);
+#else
+static inline int omap_set_barebox_part(struct omap_barebox_part *part)
+{
+	return 0;
+}
+#endif
+
 extern uint32_t omap_bootinfo[3];
 void omap_save_bootinfo(void);
 
arch/arm/mach-omap/xload.c +31 -7
index 3dbdef5..76746e2 100644
@@ -11,6 +11,15 @@
 #include <filetype.h>
 #include <mach/generic.h>
 
+struct omap_barebox_part *barebox_part;
+
+static struct omap_barebox_part default_part = {
+	.nand_offset = SZ_128K,
+	.nand_size = SZ_1M,
+	.nor_offset = SZ_128K,
+	.nor_size = SZ_1M,
+};
+
 static void *read_image_head(const char *name)
 {
 	void *header = xmalloc(ARM_HEAD_SIZE);
@@ -46,14 +55,15 @@ static unsigned int get_image_size(void *head)
 	return ret;
 }
 
-static void *omap_xload_boot_nand(int offset)
+static void *omap_xload_boot_nand(int offset, int part_size)
 {
 	int ret;
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
 
-	devfs_add_partition("nand0", offset, SZ_1M, DEVFS_PARTITION_FIXED, "x");
+	devfs_add_partition("nand0", offset, part_size,
+					DEVFS_PARTITION_FIXED, "x");
 	dev_add_bb_dev("x", "bbx");
 
 	header = read_image_head("bbx");
@@ -105,14 +115,15 @@ static void *omap_xload_boot_mmc(void)
 	return buf;
 }
 
-static void *omap_xload_boot_spi(int offset)
+static void *omap_xload_boot_spi(int offset, int part_size)
 {
 	int ret;
 	int size;
 	void *to, *header;
 	struct cdev *cdev;
 
-	devfs_add_partition("m25p0", offset, SZ_1M, DEVFS_PARTITION_FIXED, "x");
+	devfs_add_partition("m25p0", offset, part_size,
+					DEVFS_PARTITION_FIXED, "x");
 
 	header = read_image_head("x");
 	if (header == NULL)
@@ -167,6 +178,9 @@ static __noreturn int omap_xload(void)
 	int (*func)(void *) = NULL;
 	uint32_t *arg;
 
+	if (!barebox_part)
+		barebox_part = &default_part;
+
 	switch (bootsource_get())
 	{
 	case BOOTSOURCE_MMC:
@@ -183,15 +197,18 @@ static __noreturn int omap_xload(void)
 		}
 	case BOOTSOURCE_NAND:
 		printf("booting from NAND\n");
-		func = omap_xload_boot_nand(SZ_128K);
+		func = omap_xload_boot_nand(barebox_part->nand_offset,
+					barebox_part->nand_size);
 		break;
 	case BOOTSOURCE_SPI:
 		printf("booting from SPI\n");
-		func = omap_xload_boot_spi(SZ_128K);
+		func = omap_xload_boot_spi(barebox_part->nor_offset,
+					barebox_part->nor_size);
 		break;
 	default:
 		printf("unknown boot source. Fall back to nand\n");
-		func = omap_xload_boot_nand(SZ_128K);
+		func = omap_xload_boot_nand(barebox_part->nand_offset,
+					barebox_part->nand_size);
 		break;
 	}
 
@@ -208,6 +225,13 @@ static __noreturn int omap_xload(void)
 	while (1);
 }
 
+int omap_set_barebox_part(struct omap_barebox_part *part)
+{
+	barebox_part = part;
+
+	return 0;
+}
+
 static int omap_set_xload(void)
 {
 	barebox_main = omap_xload;
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 8/12 PCM051: Add first stage support

In reply to Teresa Gámez

From: Shravan kumar <[email protected]>

This patch adds first stage support for PCM051.

---
Changes in v2:
- fixed aligment and register adress
order in mach/am33xx-silicon.h

 arch/arm/boards/pcm051/board.c                   |    1 +
 arch/arm/boards/pcm051/env/boot/sd               |    2 +-
 arch/arm/boards/pcm051/lowlevel.c                |  206 ++++++++++++++++++++++
 arch/arm/configs/pcm051_mlo_defconfig            |   33 ++++
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   13 ++
 scripts/mk-am35xx-spi-image.c                    |    2 +-
 6 files changed, 255 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/configs/pcm051_mlo_defconfig
arch/arm/boards/pcm051/board.c +1 -0
index 8701596..6ef1f4b 100644
@@ -49,6 +49,7 @@
  */
 static int pcm051_console_init(void)
 {
+	am33xx_enable_uart0_pin_mux();
 	/* Register the serial port */
 	am33xx_add_uart0();
 
arch/arm/boards/pcm051/env/boot/sd +1 -1
index f303c10..93a2357 100644
@@ -6,5 +6,5 @@ if [ "$1" = menu ]; then
 fi
 
 global.bootm.image=/boot/uImage
-global.bootm.oftree=/boot/oftree
+#global.bootm.oftree=/boot/oftree
 global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
arch/arm/boards/pcm051/lowlevel.c +206 -0

217 lines not on this page · raw message

arch/arm/configs/pcm051_mlo_defconfig new file +33 -0
new file mode 100644
index 0000000..f97a7c7
@@ -0,0 +1,33 @@
+CONFIG_ARCH_OMAP=y
+CONFIG_ARCH_AM33XX=y
+CONFIG_OMAP_BUILD_IFT=y
+CONFIG_MACH_PCM051=y
+CONFIG_OMAP_UART1=y
+CONFIG_THUMB2_BAREBOX=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+# CONFIG_BANNER is not set
+# CONFIG_MEMINFO is not set
+CONFIG_ENVIRONMENT_VARIABLES=y
+CONFIG_MMU=y
+CONFIG_TEXT_BASE=0x402F0400
+CONFIG_STACK_SIZE=0x1600
+CONFIG_MALLOC_SIZE=0x1000000
+CONFIG_PROMPT="MLO>"
+CONFIG_SHELL_NONE=y
+# CONFIG_ERRNO_MESSAGES is not set
+# CONFIG_TIMESTAMP is not set
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+CONFIG_DRIVER_SPI_OMAP3=y
+CONFIG_MTD=y
+CONFIG_MTD_M25P80=y
+CONFIG_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_MCI=y
+CONFIG_MCI_STARTUP=y
+CONFIG_MCI_OMAP_HSMMC=y
+# CONFIG_FS_RAMFS is not set
+# CONFIG_FS_DEVFS is not set
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_LFN=y
arch/arm/mach-omap/include/mach/am33xx-silicon.h +13 -0
index 8a7bd16..bd55da4 100644
@@ -105,6 +105,7 @@
 #define EMIF4_SDRAM_TIM_3_SHADOW	0x2C
 #define EMIF0_SDRAM_MGMT_CTRL		0x38
 #define EMIF0_SDRAM_MGMT_CTRL_SHD	0x3C
+#define EMIF4_ZQ_CONFIG			0xC8
 #define EMIF4_DDR_PHY_CTRL_1		0xE4
 #define EMIF4_DDR_PHY_CTRL_1_SHADOW	0xE8
 #define EMIF4_DDR_PHY_CTRL_2		0xEC
@@ -157,9 +158,11 @@
 #define	AM33XX_DATA0_WRLVL_INIT_RATIO_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x0F0)
 
 #define	AM33XX_DATA0_WRLVL_INIT_RATIO_1		(AM33XX_DDR_PHY_BASE_ADDR + 0x0F4)
+#define	AM33XX_DATA0_WRLVL_INIT_MODE_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x0F8)
 #define	AM33XX_DATA0_GATELVL_INIT_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x0FC)
 
 #define	AM33XX_DATA0_GATELVL_INIT_RATIO_1	(AM33XX_DDR_PHY_BASE_ADDR + 0x100)
+#define	AM33XX_DATA0_GATELVL_INIT_MODE_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x104)
 #define	AM33XX_DATA0_FIFO_WE_SLAVE_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x108)
 
 #define	AM33XX_DATA0_FIFO_WE_SLAVE_RATIO_1	(AM33XX_DDR_PHY_BASE_ADDR + 0x10C)
@@ -169,6 +172,16 @@
 #define AM33XX_DATA0_DLL_LOCK_DIFF_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x138)
 
 #define AM33XX_DATA0_RANK0_DELAYS_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x134)
+
+#define	AM33XX_DATA1_RD_DQS_SLAVE_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x16C)
+#define	AM33XX_DATA1_WR_DQS_SLAVE_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x180)
+
+#define	AM33XX_DATA1_WRLVL_INIT_MODE_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x19C)
+#define	AM33XX_DATA1_GATELVL_INIT_MODE_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x1A8)
+
+#define	AM33XX_DATA1_FIFO_WE_SLAVE_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x1AC)
+#define	AM33XX_DATA1_WR_DATA_SLAVE_RATIO_0	(AM33XX_DDR_PHY_BASE_ADDR + 0x1C4)
+
 #define	AM33XX_DATA1_RANK0_DELAYS_0		(AM33XX_DDR_PHY_BASE_ADDR + 0x1D8)
 
 /* Ethernet MAC ID from EFuse */
scripts/mk-am35xx-spi-image.c +1 -1
index 74e79db..b13568a 100644
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
 	int opt;
 	off_t pos;
 	size_t size;
-	uint32_t addr = 0x40200000;
+	uint32_t addr = 0x402F0400;
 	uint32_t temp;
 
 	while((opt = getopt(argc, argv, "a:")) != -1) {
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH v2 10/12 arm: omap: store boot source info from ROM loader

In reply to Teresa Gámez

The ROM loader passes the address of a buffer to the MLO in register 0. Store this data so we can find the boot source later. On the same way the bootinformation are passed to the barebox, then. It has to be enshured that r0 contains always the buffer or the boot source detection will not work.

Applied this on all OMAPs. This patch is based on work of Jan Luebbe <[email protected]>.

Compile tested on all OMAP boards.
Tested on pcm049, phyCARD-A-L1 and pcm051.

---
 arch/arm/boards/archosg9/lowlevel.c       |    5 ++++-
 arch/arm/boards/beagle/lowlevel.c         |    6 +++++-
 arch/arm/boards/beaglebone/lowlevel.c     |    5 ++++-
 arch/arm/boards/omap343xdsp/lowlevel.c    |    6 +++++-
 arch/arm/boards/omap3evm/lowlevel.c       |    5 ++++-
 arch/arm/boards/panda/lowlevel.c          |    6 +++++-
 arch/arm/boards/pcm049/lowlevel.c         |    6 +++++-
 arch/arm/boards/pcm051/lowlevel.c         |    5 ++++-
 arch/arm/boards/phycard-a-l1/lowlevel.c   |    5 ++++-
 arch/arm/boards/phycard-a-xl2/lowlevel.c  |    6 +++++-
 arch/arm/mach-omap/Makefile               |    4 ++--
 arch/arm/mach-omap/am33xx_generic.c       |   18 +++++++++++++++++-
 arch/arm/mach-omap/include/mach/generic.h |    3 +++
 arch/arm/mach-omap/omap3_generic.c        |   16 +++++++++++++---
 arch/arm/mach-omap/omap4_generic.c        |   18 +++++++++++++-----
 arch/arm/mach-omap/omap_bootinfo.S        |   25 +++++++++++++++++++++++++
 arch/arm/mach-omap/xload.c                |    8 ++++++--
 17 files changed, 124 insertions(+), 23 deletions(-)
 create mode 100644 arch/arm/mach-omap/omap_bootinfo.S
arch/arm/boards/archosg9/lowlevel.c +4 -1
index 49c1541..8be345b 100644
@@ -14,6 +14,7 @@
 #include <io.h>
 #include <init.h>
 #include <sizes.h>
+#include <mach/generic.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -64,8 +65,10 @@ static noinline void archosg9_init_lowlevel(void)
 	omap4_ddr_init(&ddr_regs_400_mhz_2cs, &core);
 }
 
-void __naked __bare_init barebox_arm_reset_vector(void)
+void __naked __bare_init barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	if (get_pc() > 0x80000000)
arch/arm/boards/beagle/lowlevel.c +5 -1
index d0fd066..ef7e3c0 100644
@@ -1,8 +1,10 @@
+#include <init.h>
 #include <io.h>
 #include <sizes.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
 #include <mach/control.h>
+#include <mach/generic.h>
 #include <mach/omap3-silicon.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
@@ -178,8 +180,10 @@ static int beagle_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __naked  __bare_init barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	beagle_board_init();
arch/arm/boards/beaglebone/lowlevel.c +4 -1
index 65d0887..d871ca1 100644
@@ -5,6 +5,7 @@
 #include <asm/barebox-arm.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/am33xx-clock.h>
+#include <mach/generic.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
@@ -248,8 +249,10 @@ static int beaglebone_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __bare_init __naked barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	beaglebone_board_init();
arch/arm/boards/omap343xdsp/lowlevel.c +5 -1
index ed675ad..61b7f99 100644
@@ -1,8 +1,10 @@
 #include <common.h>
+#include <init.h>
 #include <io.h>
 #include <sizes.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
+#include <mach/generic.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
@@ -545,8 +547,10 @@ static int sdp343x_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __naked __bare_init barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	sdp343x_board_init();
arch/arm/boards/omap3evm/lowlevel.c +4 -1
index 2d9e130..ea92835 100644
@@ -3,6 +3,7 @@
 #include <sizes.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
+#include <mach/generic.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
@@ -159,8 +160,10 @@ static int omap3_evm_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __naked __bare_init barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	omap3_evm_board_init();
arch/arm/boards/panda/lowlevel.c +5 -1
index 5d3490f..a21d559 100644
@@ -17,8 +17,10 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <io.h>
 #include <sizes.h>
+#include <mach/generic.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -76,8 +78,10 @@ static void noinline panda_init_lowlevel(void)
 		omap4460_scale_vcores(TPS62361_VSEL0_GPIO, 1210);
 }
 
-void barebox_arm_reset_vector(void)
+void __bare_init __naked barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	if (get_pc() > 0x80000000)
arch/arm/boards/pcm049/lowlevel.c +5 -1
index 6b12fa4..07cc1d7 100644
@@ -17,8 +17,10 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <io.h>
 #include <sizes.h>
+#include <mach/generic.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -106,8 +108,10 @@ static void noinline pcm049_init_lowlevel(void)
 	sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);  /* enable clocks */
 }
 
-void barebox_arm_reset_vector(void)
+void __bare_init __naked barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	if (get_pc() > 0x80000000)
arch/arm/boards/pcm051/lowlevel.c +4 -1
index 7e7633c..f4a1742 100644
@@ -6,6 +6,7 @@
 #include <asm/barebox-arm.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/am33xx-clock.h>
+#include <mach/generic.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
@@ -207,8 +208,10 @@ static int pcm051_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __naked __bare_init barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	pcm051_board_init();
arch/arm/boards/phycard-a-l1/lowlevel.c +4 -1
index 30379d8..7855040 100644
@@ -5,6 +5,7 @@
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
 #include <mach/omap3-mux.h>
+#include <mach/generic.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
 #include <mach/syslib.h>
@@ -250,8 +251,10 @@ static int pcaal1_board_init(void)
 	return 0;
 }
 
-void __naked barebox_arm_reset_vector(void)
+void __bare_init __naked barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	pcaal1_board_init();
arch/arm/boards/phycard-a-xl2/lowlevel.c +5 -1
index 010171a..9a794b7 100644
@@ -17,8 +17,10 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <io.h>
 #include <sizes.h>
+#include <mach/generic.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -86,8 +88,10 @@ static noinline void pcaaxl2_init_lowlevel(void)
 	sr32(0x4A30a110, 2, 2, 0x3);  /* enable clocks */
 }
 
-void barebox_arm_reset_vector(void)
+void __bare_init __naked barebox_arm_reset_vector(uint32_t *data)
 {
+	omap_save_bootinfo();
+
 	arm_cpu_lowlevel_init();
 
 	if (get_pc() > 0x80000000)
arch/arm/mach-omap/Makefile +2 -2
index e5759f5..2163c3f 100644
@@ -15,8 +15,8 @@
 # GNU General Public License for more details.
 #
 #
-obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.o omap_bootinfo.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o omap_bootinfo.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
 obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
arch/arm/mach-omap/am33xx_generic.c +17 -1
index ac99035..a653ef7 100644
@@ -25,6 +25,7 @@
 #include <net.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/am33xx-clock.h>
+#include <mach/generic.h>
 #include <mach/sys_info.h>
 #include <mach/am33xx-generic.h>
 #include <mach/gpmc.h>
@@ -98,7 +99,22 @@ u32 running_in_sdram(void)
 
 static int am33xx_bootsource(void)
 {
-	bootsource_set(BOOTSOURCE_MMC); /* only MMC for now */
+	enum bootsource src;
+
+	switch (omap_bootinfo[2] & 0xFF) {
+	case 0x05:
+		src = BOOTSOURCE_NAND;
+		break;
+	case 0x08:
+		src = BOOTSOURCE_MMC;
+		break;
+	case 0x0b:
+		src = BOOTSOURCE_SPI;
+		break;
+	default:
+		src = BOOTSOURCE_UNKNOWN;
+	}
+	bootsource_set(src);
 	bootsource_set_instance(0);
 	return 0;
 }
arch/arm/mach-omap/include/mach/generic.h +3 -0
index 178c21f..9c474e2 100644
@@ -33,4 +33,7 @@
 #define cpu_is_am33xx()		(0)
 #endif
 
+extern uint32_t omap_bootinfo[3];
+void omap_save_bootinfo(void);
+
 #endif
arch/arm/mach-omap/omap3_generic.c +13 -3
index f144813..8b661ff 100644
@@ -33,6 +33,7 @@
 #include <io.h>
 #include <mach/omap3-silicon.h>
 #include <mach/gpmc.h>
+#include <mach/generic.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
 #include <mach/omap3-smx.h>
@@ -468,12 +469,21 @@ void omap3_core_init(void)
 static int omap3_bootsource(void)
 {
 	enum bootsource src = BOOTSOURCE_UNKNOWN;
-	u32 bootsrc = readl(OMAP3_TRACING_VECTOR1);
 
-	if (bootsrc & (1 << 2))
+	switch (omap_bootinfo[1] & 0xFF) {
+	case 0x02:
 		src = BOOTSOURCE_NAND;
-	if (bootsrc & (1 << 6))
+		break;
+	case 0x06:
 		src = BOOTSOURCE_MMC;
+		break;
+	case 0x11:
+		src = BOOTSOURCE_USB;
+		break;
+	default:
+		src = BOOTSOURCE_UNKNOWN;
+	}
+
 	bootsource_set(src);
 	bootsource_set_instance(0);
 
arch/arm/mach-omap/omap4_generic.c +13 -5
index a082b71..54cefa2 100644
@@ -6,6 +6,7 @@
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-mux.h>
 #include <mach/syslib.h>
+#include <mach/generic.h>
 #include <mach/gpmc.h>
 #include <mach/gpio.h>
 #include <mach/omap4_rom_usb.h>
@@ -504,14 +505,21 @@ static int omap_vector_init(void)
 static int omap4_bootsource(void)
 {
 	enum bootsource src = BOOTSOURCE_UNKNOWN;
-	u32 bootsrc = readl(OMAP4_TRACING_VECTOR3);
 
-	if (bootsrc & (1 << 5))
-		src = BOOTSOURCE_MMC;
-	else if (bootsrc & (1 << 3))
+	switch (omap_bootinfo[2] & 0xFF) {
+	case 0x03:
 		src = BOOTSOURCE_NAND;
-	else if (bootsrc & (1<<20))
+		break;
+	case 0x05:
+		src = BOOTSOURCE_MMC;
+		break;
+	case 0x20:
 		src = BOOTSOURCE_USB;
+		break;
+	default:
+		src = BOOTSOURCE_UNKNOWN;
+	}
+
 	bootsource_set(src);
 	bootsource_set_instance(0);
 
arch/arm/mach-omap/omap_bootinfo.S new file +25 -0
new file mode 100644
index 0000000..ffd0a3d
@@ -0,0 +1,25 @@
+#include <config.h>
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+.section ".text_bare_init","ax"
+.globl omap_bootinfo
+omap_bootinfo:
+	.word 0x0
+	.word 0x0
+	.word 0x0
+
+.section ".text_bare_init","ax"
+ENTRY(omap_save_bootinfo)
+	/*
+	* save data from rom boot loader
+	*/
+	adr     r2, omap_bootinfo
+	ldr     r1, [r0, #0x00]
+	str     r1, [r2, #0x00]
+	ldr     r1, [r0, #0x04]
+	str     r1, [r2, #0x04]
+	ldr     r1, [r0, #0x08]
+	str     r1, [r2, #0x08]
+	mov	pc, lr
+ENDPROC(omap_save_bootinfo)
arch/arm/mach-omap/xload.c +6 -2
index 3cce3f2..3dbdef5 100644
@@ -9,6 +9,7 @@
 #include <fcntl.h>
 #include <sizes.h>
 #include <filetype.h>
+#include <mach/generic.h>
 
 static void *read_image_head(const char *name)
 {
@@ -163,7 +164,8 @@ static void *omap4_xload_boot_usb(void){
  */
 static __noreturn int omap_xload(void)
 {
-	int (*func)(void) = NULL;
+	int (*func)(void *) = NULL;
+	uint32_t *arg;
 
 	switch (bootsource_get())
 	{
@@ -198,8 +200,10 @@ static __noreturn int omap_xload(void)
 		while (1);
 	}
 
+	arg = (uint32_t *)&omap_bootinfo;
+
 	shutdown_barebox();
-	func();
+	func(arg);
 
 	while (1);
 }
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw
In reply to Teresa Gámez
Quoted 1 line · Teresa Gámez

Applied this series.

Thanks
Sascha

Quoted 97 lines
---
 arch/arm/mach-omap/am33xx_generic.c          |   15 +++++++++++++++
 arch/arm/mach-omap/am33xx_mux.c              |    8 +++++---
 arch/arm/mach-omap/include/mach/am33xx-mux.h |    1 +
 arch/arm/mach-omap/include/mach/gpmc_nand.h  |    1 +
 4 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/mach-omap/am33xx_generic.c +15 -0
index 96432c9..9806fbe 100644
@@ -27,6 +27,7 @@
 #include <mach/am33xx-clock.h>
 #include <mach/sys_info.h>
 #include <mach/am33xx-generic.h>
+#include <mach/gpmc.h>
 
 void __noreturn reset_cpu(unsigned long addr)
 {
@@ -126,3 +127,17 @@ int am33xx_register_ethaddr(int eth_id, int mac_id)
 
 	return -ENODEV;
 }
+
+/* GPMC timing for AM33XX nand device */
+const struct gpmc_config am33xx_nand_cfg = {
+	.cfg = {
+		0x00000800,	/* CONF1 */
+		0x001e1e00,	/* CONF2 */
+		0x001e1e00,	/* CONF3 */
+		0x16051807,	/* CONF4 */
+		0x00151e1e,	/* CONF5 */
+		0x16000f80,	/* CONF6 */
+	},
+	.base = 0x08000000,
+	.size = GPMC_SIZE_16M,
+};
arch/arm/mach-omap/am33xx_mux.c +5 -3
index abc8586..8318713 100644
@@ -39,8 +39,6 @@ static const __maybe_unused struct module_pin_mux uart3_pin_mux[] = {
 	{-1},
 };
 
-
-#ifdef CONFIG_NAND
 static const __maybe_unused struct module_pin_mux nand_pin_mux[] = {
 	{OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)},	/* NAND AD0 */
 	{OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)},	/* NAND AD1 */
@@ -59,7 +57,6 @@ static const __maybe_unused struct module_pin_mux nand_pin_mux[] = {
 	{OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)},	/* NAND_BE_CLE */
 	{-1},
 };
-#endif
 
 static const __maybe_unused struct module_pin_mux i2c0_pin_mux[] = {
 	{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},	/* I2C_DATA */
@@ -319,3 +316,8 @@ void am33xx_enable_spi0_pin_mux(void)
 {
 	configure_module_pin_mux(spi0_pin_mux);
 }
+
+void am33xx_enable_nand_pin_mux(void)
+{
+	configure_module_pin_mux(nand_pin_mux);
+}
arch/arm/mach-omap/include/mach/am33xx-mux.h +1 -0
index d6b19dd..fe3168b 100644
@@ -257,5 +257,6 @@ extern void am33xx_enable_uart0_pin_mux(void);
 extern void am33xx_enable_uart2_pin_mux(void);
 extern void am33xx_enable_mmc0_pin_mux(void);
 extern void am33xx_enable_spi0_pin_mux(void);
+extern void am33xx_enable_nand_pin_mux(void);
 
 #endif /*__AM33XX_MUX_H__ */
arch/arm/mach-omap/include/mach/gpmc_nand.h +1 -0
index 4a93465..8d138ec 100644
@@ -65,5 +65,6 @@ int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata);
 
 extern struct gpmc_config omap3_nand_cfg;
 extern struct gpmc_config omap4_nand_cfg;
+extern struct gpmc_config am33xx_nand_cfg;
 
 #endif				/* __ASM_OMAP_NAND_GPMC_H */
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCHv2 08/12] PCM051: Add first stage support

In reply to Teresa Gámez

Am 09.07.2013 11:23, schrieb Teresa Gámez:

Hello Sascha,

Quoted 28 lines

From: Shravan kumar <[email protected]>

This patch adds first stage support for PCM051.

---
Changes in v2:
- fixed aligment and register adress
order in mach/am33xx-silicon.h

  arch/arm/boards/pcm051/board.c                   |    1 +
  arch/arm/boards/pcm051/env/boot/sd               |    2 +-
  arch/arm/boards/pcm051/lowlevel.c                |  206 ++++++++++++++++++++++
  arch/arm/configs/pcm051_mlo_defconfig            |   33 ++++
  arch/arm/mach-omap/include/mach/am33xx-silicon.h |   13 ++
  scripts/mk-am35xx-spi-image.c                    |    2 +-
  6 files changed, 255 insertions(+), 2 deletions(-)

create mode 100644 arch/arm/configs/pcm051_mlo_defconfig

/* Ethernet MAC ID from EFuse */

scripts/mk-am35xx-spi-image.c +0 -0
index 74e79db..b13568a 100644

scripts/mk-am35xx-spi-image.c int main(int argc, char *argv[]) · line 69

Quoted 8 lines
scripts/mk-am35xx-spi-image.c +1 -1
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
  	int opt;
  	off_t pos;
  	size_t size;
-	uint32_t addr = 0x40200000;
+	uint32_t addr = 0x402F0400;
  	uint32_t temp;
 
  	while((opt = getopt(argc, argv, "a:")) != -1) {

This last hunk has accidentally slipped in here.
Could you remove it?

Thanks
Teresa

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#9 lore raw

Re: [PATCHv2 08/12] PCM051: Add first stage support

Hi Teresa,

Quoted 25 lines · Teresa Gamez

Am 09.07.2013 11:23, schrieb Teresa Gámez:

Hello Sascha,

Quoted 21 lines

From: Shravan kumar <[email protected]>

This patch adds first stage support for PCM051.

---
Changes in v2:
- fixed aligment and register adress
order in mach/am33xx-silicon.h

 arch/arm/boards/pcm051/board.c                   |    1 +
 arch/arm/boards/pcm051/env/boot/sd               |    2 +-
 arch/arm/boards/pcm051/lowlevel.c                |  206 ++++++++++++++++++++++
 arch/arm/configs/pcm051_mlo_defconfig            |   33 ++++
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   13 ++
 scripts/mk-am35xx-spi-image.c                    |    2 +-
 6 files changed, 255 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/configs/pcm051_mlo_defconfig
Quoted 16 lines

scripts/mk-am35xx-spi-image.c int main(int argc, char *argv[]) · line 68

Quoted 13 lines

/* Ethernet MAC ID from EFuse */

scripts/mk-am35xx-spi-image.c +1 -1
index 74e79db..b13568a 100644
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
 	int opt;
 	off_t pos;
 	size_t size;
-	uint32_t addr = 0x40200000;
+	uint32_t addr = 0x402F0400;
 	uint32_t temp;
 	while((opt = getopt(argc, argv, "a:")) != -1) {

This last hunk has accidentally slipped in here.
Could you remove it?

No problem, I removed it.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox