Skip to contentSkip to conversation

archosg9: add support for tablet

RFC PATCH In review vj 3 participants 17 messages Sep 25, 2012 – Sep 28, 2012 1 message not in the archive

Subsystems (7)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [RFC][PATCH] archosg9: add support for tablet

vj

author
#1 lore raw

cover archosg9: add support for tablet

Hello,
A this is my first contribution, so I'm basically requesting for comments.

The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu.
The tablet by default only boots from internal flash, so to test barebox on it a hardware tweak is required: change the sys_boot configuration. Once done the tablet can be booted with the following command:
A sudo scripts/usbboot <first_stage> <rootfs>

The patch contains
A 1.- specific changes for OMAP4460
A 2.- support for usb-booting
A 3.- support for console on usb
A 4.- support for file transfer through usb
A 5.- some minor bug fixes
A 6.- adds support for archosg9 board

A question I have is what does omap_vector_init do?
It breaks usb-booting.
An improvement to be done would be to split the file "scripts/usbboot.c" into a header and two c files, but the Makefile framework seemed to me to do not allow that.

In any case the patch should be tested with other boards to check it does not breaks something.

vj (7):
Improved an error message and solved a minor bug added debug info for twl6030
OMAP specific changes
Add USB booting capabilities to OMAP
add console support over the same USB used for booting add filesystem support over the same USB used for booting Add support for Archos G9 tablet

 arch/arm/Makefile                               |   1 +
 arch/arm/boards/archosg9/Makefile               |   1 +
 arch/arm/boards/archosg9/board.c                |  58 ++
 arch/arm/boards/archosg9/env/bin/init           |  18 +
 arch/arm/boards/archosg9/env/config             |   2 +
 arch/arm/boards/archosg9/lowlevel.c             | 126 ++++
 arch/arm/boards/archosg9/mux.c                  | 226 +++++++
 arch/arm/configs/archosg9_defconfig             |  70 +++
 arch/arm/configs/archosg9_xload_defconfig       |  25 +
 arch/arm/cpu/cpu.c                              |   1 +
 arch/arm/lib/armlinux.c                         |   2 +-
 arch/arm/lib/barebox.lds.S                      |  10 +
 arch/arm/mach-omap/Kconfig                      |  30 +
 arch/arm/mach-omap/Makefile                     |   1 +
 arch/arm/mach-omap/include/mach/omap4-mux.h     |  80 ++-
 arch/arm/mach-omap/include/mach/omap4-silicon.h |  13 +
 arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
 arch/arm/mach-omap/include/mach/xload.h         |   1 +
 arch/arm/mach-omap/omap4_generic.c              |   6 +
 arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
 arch/arm/mach-omap/xload.c                      |  26 +
 arch/arm/tools/mach-types                       |   1 +
 drivers/mci/omap_hsmmc.c                        |   2 +-
 drivers/mfd/twl6030.c                           |  13 +
 drivers/serial/Kconfig                          |   7 +
 drivers/serial/Makefile                         |   1 +
 drivers/serial/serial_usb.c                     |  64 ++
 fs/Kconfig                                      |   5 +
 fs/Makefile                                     |   1 +
 fs/usbbootfs.c                                  | 195 ++++++
 include/mfd/twl6030.h                           |   8 +
 scripts/.gitignore                              |   1 +
 scripts/Makefile                                |   3 +
 scripts/usbboot.c                               | 797 ++++++++++++++++++++++++
 34 files changed, 2100 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/Makefile
 create mode 100644 arch/arm/boards/archosg9/board.c
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/config
 create mode 100644 arch/arm/boards/archosg9/lowlevel.c
 create mode 100644 arch/arm/boards/archosg9/mux.c
 create mode 100644 arch/arm/configs/archosg9_defconfig
 create mode 100644 arch/arm/configs/archosg9_xload_defconfig
 create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
 create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
 create mode 100644 drivers/serial/serial_usb.c
 create mode 100644 fs/usbbootfs.c
 create mode 100644 scripts/usbboot.c
Signature · 7 lines
1.7.12.1


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

PATCH 1/7 Improved an error message and solved a minor bug

---
 arch/arm/lib/armlinux.c  | 2 +-
 drivers/mci/omap_hsmmc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/lib/armlinux.c +1 -1
index 191274e..74d59a9 100644
@@ -80,7 +80,7 @@ void armlinux_set_revision(unsigned int rev)
 #ifdef CONFIG_ENVIRONMENT_VARIABLES
 	export_env_ull("armlinux_system_rev", rev);
 #else
-	return armlinux_system_rev;
+	armlinux_system_rev = rev;
 #endif
 }
 
drivers/mci/omap_hsmmc.c +1 -1
index e0b245b..e6f4e47 100644
@@ -238,7 +238,7 @@ static int mmc_init_setup(struct mci_host *mci, struct device_d *dev)
 	start = get_time_ns();
 	while ((readl(&mmc_base->sysstatus) & RESETDONE) == 0) {
 		if (is_timeout(start, SECOND)) {
-			dev_dbg(hsmmc->dev, "timedout waiting for cc2!\n");
+			dev_dbg(hsmmc->dev, "timeout waiting for reset done\n");
 			return -ETIMEDOUT;
 		}
 	}
Signature · 7 lines
1.7.12.1


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

Re: [PATCH 1/7] Improved an error message and solved a minor bug

Quoted 23 lines · vj
---
 arch/arm/lib/armlinux.c  | 2 +-
 drivers/mci/omap_hsmmc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/lib/armlinux.c +1 -1
index 191274e..74d59a9 100644
@@ -80,7 +80,7 @@ void armlinux_set_revision(unsigned int rev)
 #ifdef CONFIG_ENVIRONMENT_VARIABLES
 	export_env_ull("armlinux_system_rev", rev);
 #else
-	return armlinux_system_rev;
+	armlinux_system_rev = rev;
 #endif
 }
 
drivers/mci/omap_hsmmc.c +0 -0
index e0b245b..e6f4e47 100644

drivers/mci/omap_hsmmc.c static int mmc_init_setup(struct mci_host *mci, struct device_d *dev) · line 244

Quoted 8 lines
drivers/mci/omap_hsmmc.c +1 -1
@@ -238,7 +238,7 @@ static int mmc_init_setup(struct mci_host *mci, struct device_d *dev)
 	start = get_time_ns();
 	while ((readl(&mmc_base->sysstatus) & RESETDONE) == 0) {
 		if (is_timeout(start, SECOND)) {
-			dev_dbg(hsmmc->dev, "timedout waiting for cc2!\n");
+			dev_dbg(hsmmc->dev, "timeout waiting for reset done\n");
 			return -ETIMEDOUT;
 		}
 	}

This looks good, but it should be two patches. Please always give the subject the context of the patches, that would be "ARM: ..." for the first one and "mmc omap: ..."

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
author
#4 lore raw

PATCH 2/7 added debug info for twl6030

In reply to vj
---
 drivers/mfd/twl6030.c | 13 +++++++++++++
 include/mfd/twl6030.h |  8 ++++++++
 2 files changed, 21 insertions(+)
drivers/mfd/twl6030.c +13 -0
index 7ecfed8..a2d16a1 100644
@@ -39,6 +39,19 @@ static int twl_probe(struct device_d *dev)
 
 	devfs_create(&(twl_dev->core.cdev));
 
+#ifdef DEBUG
+    {
+        u8 i, jtag_rev, eprom_rev;
+        int r;
+        u64 dieid;
+        r =twl6030_reg_read(twl_dev, TWL6030_JTAG_JTAGVERNUM, &jtag_rev );
+        r|=twl6030_reg_read(twl_dev, TWL6030_JTAG_EPROM_REV , &eprom_rev);
+        for(i=0; i<8; i++) r|=twl6030_reg_read(twl_dev, TWL6030_DIEID_0+i, ((u8*)(&dieid))+i);
+        if(r) debug("TWL6030 Error reading ID\n");
+        else  debug("TWL6030 JTAG REV: 0x%02X, EPROM REV: 0x%02X DIE ID: 0x%016llX\n", (unsigned)jtag_rev, (unsigned)eprom_rev, dieid);
+    }
+#endif
+
 	return 0;
 }
 
include/mfd/twl6030.h +8 -0
index f1278d4..bb4f773 100644
@@ -371,6 +371,14 @@ enum twl6030_reg {
 	/* JTAG */
 	TWL6030_JTAG_JTAGVERNUM = 0x0287,
 	TWL6030_JTAG_EPROM_REV = 0x02DF,
+	TWL6030_DIEID_0 = 0x02C0,
+	TWL6030_DIEID_1 = 0x02C1,
+	TWL6030_DIEID_2 = 0x02C2,
+	TWL6030_DIEID_3 = 0x02C3,
+	TWL6030_DIEID_4 = 0x02C4,
+	TWL6030_DIEID_5 = 0x02C5,
+	TWL6030_DIEID_6 = 0x02C6,
+	TWL6030_DIEID_7 = 0x02C7,
 	/* GPADC Trimming */
 	TWL6030_GPADC_TRIM1 = 0x02CD,
 	TWL6030_GPADC_TRIM2 = 0x02CE,
Signature · 7 lines
1.7.12.1


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

PATCH 3/7 OMAP specific changes

In reply to vj

mux:
added definitions with the same names as in the datasheet added two new definitions
changed PAD definitions to have the same names in the datasheet changed value for jtag_tck to match the one on the datasheet
added base addresses and usb bootsrc

---
 arch/arm/mach-omap/include/mach/omap4-mux.h     | 80 ++++++++++++++++---------
 arch/arm/mach-omap/include/mach/omap4-silicon.h | 13 ++++
 arch/arm/mach-omap/include/mach/xload.h         |  1 +
 arch/arm/mach-omap/omap4_generic.c              |  4 ++
 4 files changed, 70 insertions(+), 28 deletions(-)
arch/arm/mach-omap/include/mach/omap4-mux.h +52 -28
index d06beaa..4938f1b 100644
@@ -36,6 +36,7 @@ struct pad_conf_entry {
 
 } __attribute__ ((packed));
 
+#define WAKEUP_EN       (1 << 14)
 #ifdef CONFIG_OFF_PADCONF
 #define OFF_PD          (1 << 12)
 #define OFF_PU          (3 << 12)
@@ -127,14 +128,23 @@ struct pad_conf_entry {
 #define GPMC_WAIT0		0x008A
 #define GPMC_WAIT1		0x008C
 #define C2C_DATA11		0x008E
+#define GPMC_WAIT2		0x008E
 #define C2C_DATA12		0x0090
+#define GPMC_NCS4		0x0090
 #define C2C_DATA13		0x0092
+#define GPMC_NCS5		0x0092
 #define C2C_DATA14		0x0094
+#define GPMC_NCS6		0x0094
 #define C2C_DATA15		0x0096
+#define GPMC_NCS7		0x0096
 #define HDMI_HPD		0x0098
+#define GPIO63			0x0098
 #define HDMI_CEC		0x009A
+#define GPIO64			0x009A
 #define HDMI_DDC_SCL		0x009C
+#define GPIO65			0x009C
 #define HDMI_DDC_SDA		0x009E
+#define GPIO66			0x009E
 #define CSI21_DX0		0x00A0
 #define CSI21_DY0		0x00A2
 #define CSI21_DX1		0x00A4
@@ -246,17 +256,29 @@ struct pad_conf_entry {
 #define USBB2_HSIC_DATA		0x0178
 #define USBB2_HSIC_STROBE	0x017A
 #define UNIPRO_TX0		0x017C
+#define KPD_COL3		0x017C
 #define UNIPRO_TY0		0x017E
+#define KPD_COL4		0x017E
 #define UNIPRO_TX1		0x0180
+#define KPD_COL5		0x0180
 #define UNIPRO_TY1		0x0182
+#define KPD_COL0		0x0182
 #define UNIPRO_TX2		0x0184
+#define KPD_COL1		0x0184
 #define UNIPRO_TY2		0x0186
+#define KPD_COL2		0x0186
 #define UNIPRO_RX0		0x0188
+#define KPD_ROW3		0x0188
 #define UNIPRO_RY0		0x018A
+#define KPD_ROW4		0x018A
 #define UNIPRO_RX1		0x018C
+#define KPD_ROW5		0x018C
 #define UNIPRO_RY1		0x018E
+#define KPD_ROW0		0x018E
 #define UNIPRO_RX2		0x0190
+#define KPD_ROW1		0x0190
 #define UNIPRO_RY2		0x0192
+#define KPD_ROW2		0x0192
 #define USBA0_OTG_CE		0x0194
 #define USBA0_OTG_DP		0x0196
 #define USBA0_OTG_DM		0x0198
@@ -290,6 +312,8 @@ struct pad_conf_entry {
 #define DPM_EMU17		0x01D0
 #define DPM_EMU18		0x01D2
 #define DPM_EMU19		0x01D4
+#define CSI22_DX2		0x01D6
+#define CSI22_DY2		0x01F4
 #define WAKEUPEVENT_0		0x01D8
 #define WAKEUPEVENT_1		0x01DC
 #define WAKEUPEVENT_2		0x01E0
@@ -301,34 +325,34 @@ struct pad_conf_entry {
 #define WKUP_REVISION		0x0000
 #define WKUP_HWINFO		0x0004
 #define WKUP_SYSCONFIG		0x0010
-#define PAD0_SIM_IO		0x0040
-#define PAD1_SIM_CLK		0x0042
-#define PAD0_SIM_RESET		0x0044
-#define PAD1_SIM_CD		0x0046
-#define PAD0_SIM_PWRCTRL		0x0048
-#define PAD1_SR_SCL		0x004A
-#define PAD0_SR_SDA		0x004C
-#define PAD1_FREF_XTAL_IN		0x004E
-#define PAD0_FREF_SLICER_IN	0x0050
-#define PAD1_FREF_CLK_IOREQ	0x0052
-#define PAD0_FREF_CLK0_OUT		0x0054
-#define PAD1_FREF_CLK3_REQ		0x0056
-#define PAD0_FREF_CLK3_OUT		0x0058
-#define PAD1_FREF_CLK4_REQ		0x005A
-#define PAD0_FREF_CLK4_OUT		0x005C
-#define PAD1_SYS_32K		0x005E
-#define PAD0_SYS_NRESPWRON		0x0060
-#define PAD1_SYS_NRESWARM		0x0062
-#define PAD0_SYS_PWR_REQ		0x0064
-#define PAD1_SYS_PWRON_RESET	0x0066
-#define PAD0_SYS_BOOT6		0x0068
-#define PAD1_SYS_BOOT7		0x006A
-#define PAD0_JTAG_NTRST		0x006C
-#define PAD1_JTAG_TCK		0x006D
-#define PAD0_JTAG_RTCK		0x0070
-#define PAD1_JTAG_TMS_TMSC		0x0072
-#define PAD0_JTAG_TDI		0x0074
-#define PAD1_JTAG_TDO		0x0076
+#define GPIO_WK0		0x0040
+#define GPIO_WK1		0x0042
+#define GPIO_WK2		0x0044
+#define GPIO_WK3		0x0046
+#define GPIO_WK4		0x0048
+#define SR_SCL			0x004A
+#define SR_SDA			0x004C
+#define FREF_XTAL_IN		0x004E
+#define FREF_SLICER_IN		0x0050
+#define FREF_CLK_IOREQ		0x0052
+#define FREF_CLK0_OUT		0x0054
+#define FREF_CLK3_REQ		0x0056
+#define FREF_CLK3_OUT		0x0058
+#define FREF_CLK4_REQ		0x005A
+#define FREF_CLK4_OUT		0x005C
+#define SYS_32K		0x005E
+#define SYS_NRESPWRON		0x0060
+#define SYS_NRESWARM		0x0062
+#define SYS_PWR_REQ		0x0064
+#define SYS_PWRON_RESET_OUT	0x0066
+#define SYS_BOOT6		0x0068
+#define SYS_BOOT7		0x006A
+#define JTAG_NTRST		0x006C
+#define JTAG_TCK		0x006E
+#define JTAG_RTCK		0x0070
+#define JTAG_TMS_TMSC		0x0072
+#define JTAG_TDI		0x0074
+#define JTAG_TDO		0x0076
 #define PADCONF_WAKEUPEVENT_0	0x007C
 #define CONTROL_SMART1NOPMIO_PADCONF_0		0x05A0
 #define CONTROL_SMART1NOPMIO_PADCONF_1		0x05A4
arch/arm/mach-omap/include/mach/omap4-silicon.h +13 -0
index 4082bac..a6b3f2b 100644
@@ -76,6 +76,12 @@
 #define OMAP44XX_UART2_BASE		(OMAP44XX_L4_PER_BASE + 0x6c000)
 #define OMAP44XX_UART3_BASE		(OMAP44XX_L4_PER_BASE + 0x20000)
 
+/* I2C */
+#define OMAP44XX_I2C1_BASE		(OMAP44XX_L4_PER_BASE + 0x070000)
+#define OMAP44XX_I2C2_BASE		(OMAP44XX_L4_PER_BASE + 0x072000)
+#define OMAP44XX_I2C3_BASE		(OMAP44XX_L4_PER_BASE + 0x060000)
+#define OMAP44XX_I2C4_BASE		(OMAP44XX_L4_PER_BASE + 0x350000)
+
 /* General Purpose Timers */
 #define OMAP44XX_GPT1_BASE		(OMAP44XX_L4_WKUP_BASE + 0x18000)
 #define OMAP44XX_GPT2_BASE		(OMAP44XX_L4_PER_BASE  + 0x32000)
@@ -92,6 +98,13 @@
 /* 32KTIMER */
 #define OMAP_32KTIMER_BASE		(OMAP44XX_L4_WKUP_BASE + 0x4000)
 
+/* MMC */
+#define OMAP44XX_MMC1_BASE		(OMAP44XX_L4_PER_BASE + 0x09C100)
+#define OMAP44XX_MMC2_BASE		(OMAP44XX_L4_PER_BASE + 0x0B4100)
+#define OMAP44XX_MMC3_BASE		(OMAP44XX_L4_PER_BASE + 0x0AD100)
+#define OMAP44XX_MMC4_BASE		(OMAP44XX_L4_PER_BASE + 0x0D1100)
+#define OMAP44XX_MMC5_BASE		(OMAP44XX_L4_PER_BASE + 0x0D5100)
+
 /* GPMC */
 #define OMAP_GPMC_BASE		0x50000000
 
arch/arm/mach-omap/include/mach/xload.h +1 -0
index 844b57f..cfc3f68 100644
@@ -8,6 +8,7 @@ enum omap_boot_src {
 	OMAP_BOOTSRC_UNKNOWN,
 	OMAP_BOOTSRC_MMC1,
 	OMAP_BOOTSRC_NAND,
+	OMAP_BOOTSRC_USB1,
 };
 
 enum omap_boot_src omap3_bootsrc(void);
arch/arm/mach-omap/omap4_generic.c +4 -0
index 617d786..55d8fe3 100644
@@ -481,6 +481,10 @@ enum omap_boot_src omap4_bootsrc(void)
 		return OMAP_BOOTSRC_MMC1;
 	if (bootsrc & (1 << 3))
 		return OMAP_BOOTSRC_NAND;
+#ifdef CONFIG_USB_BOOT
+	if (bootsrc & (1<<20))
+		return OMAP_BOOTSRC_USB1;
+#endif
 	return OMAP_BOOTSRC_UNKNOWN;
 }
 
Signature · 7 lines
1.7.12.1


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

Re: [PATCH 3/7] OMAP specific changes

Quoted 63 lines · vj

mux:
added definitions with the same names as in the datasheet added two new definitions
changed PAD definitions to have the same names in the datasheet changed value for jtag_tck to match the one on the datasheet
added base addresses and usb bootsrc

---
 arch/arm/mach-omap/include/mach/omap4-mux.h     | 80 ++++++++++++++++---------
 arch/arm/mach-omap/include/mach/omap4-silicon.h | 13 ++++
 arch/arm/mach-omap/include/mach/xload.h         |  1 +
 arch/arm/mach-omap/omap4_generic.c              |  4 ++
 4 files changed, 70 insertions(+), 28 deletions(-)
arch/arm/mach-omap/include/mach/omap4-mux.h +18 -28
@@ -301,34 +325,34 @@ struct pad_conf_entry {
 #define WKUP_REVISION		0x0000
 #define WKUP_HWINFO		0x0004
 #define WKUP_SYSCONFIG		0x0010
-#define PAD0_SIM_IO		0x0040
-#define PAD1_SIM_CLK		0x0042
-#define PAD0_SIM_RESET		0x0044
-#define PAD1_SIM_CD		0x0046
-#define PAD0_SIM_PWRCTRL		0x0048
-#define PAD1_SR_SCL		0x004A
-#define PAD0_SR_SDA		0x004C
-#define PAD1_FREF_XTAL_IN		0x004E
-#define PAD0_FREF_SLICER_IN	0x0050
-#define PAD1_FREF_CLK_IOREQ	0x0052
-#define PAD0_FREF_CLK0_OUT		0x0054
-#define PAD1_FREF_CLK3_REQ		0x0056
-#define PAD0_FREF_CLK3_OUT		0x0058
-#define PAD1_FREF_CLK4_REQ		0x005A
-#define PAD0_FREF_CLK4_OUT		0x005C
-#define PAD1_SYS_32K		0x005E
-#define PAD0_SYS_NRESPWRON		0x0060
-#define PAD1_SYS_NRESWARM		0x0062
-#define PAD0_SYS_PWR_REQ		0x0064
-#define PAD1_SYS_PWRON_RESET	0x0066
-#define PAD0_SYS_BOOT6		0x0068
-#define PAD1_SYS_BOOT7		0x006A
-#define PAD0_JTAG_NTRST		0x006C
-#define PAD1_JTAG_TCK		0x006D
-#define PAD0_JTAG_RTCK		0x0070
-#define PAD1_JTAG_TMS_TMSC		0x0072
-#define PAD0_JTAG_TDI		0x0074
-#define PAD1_JTAG_TDO		0x0076
+#define GPIO_WK0		0x0040
+#define GPIO_WK1		0x0042
+#define GPIO_WK2		0x0044
+#define GPIO_WK3		0x0046
+#define GPIO_WK4		0x0048
+#define SR_SCL			0x004A
+#define SR_SDA			0x004C
+#define FREF_XTAL_IN		0x004E
+#define FREF_SLICER_IN		0x0050
+#define FREF_CLK_IOREQ		0x0052
+#define FREF_CLK0_OUT		0x0054
+#define FREF_CLK3_REQ		0x0056
+#define FREF_CLK3_OUT		0x0058
+#define FREF_CLK4_REQ		0x005A
+#define FREF_CLK4_OUT		0x005C
+#define SYS_32K		0x005E
+#define SYS_NRESPWRON		0x0060
+#define SYS_NRESWARM		0x0062

arch/arm/mach-omap/include/mach/omap4-mux.h struct pad_conf_entry { · line 355

Quoted 10 lines
arch/arm/mach-omap/include/mach/omap4-mux.h +10 -0
+#define SYS_PWR_REQ		0x0064
+#define SYS_PWRON_RESET_OUT	0x0066
+#define SYS_BOOT6		0x0068
+#define SYS_BOOT7		0x006A
+#define JTAG_NTRST		0x006C
+#define JTAG_TCK		0x006E
+#define JTAG_RTCK		0x0070
+#define JTAG_TMS_TMSC		0x0072
+#define JTAG_TDI		0x0074
+#define JTAG_TDO		0x0076

Renaming these is ok, but you have to change the code which uses these defines aswell:

./arch/arm/boards/phycard-a-xl2/mux.c:220: {PAD1_SR_SCL, (PTU | IEN| M0)}, /* sr_scl */

./arch/arm/boards/pcm049/mux.c:220:     {PAD1_SR_SCL, (PTU | IEN | M0)},/* sr_scl */
./arch/arm/boards/panda/mux.c:220:      { PAD1_SR_SCL, PTU | IEN | M0/* sr_scl */ },
Quoted 17 lines
arch/arm/mach-omap/include/mach/xload.h +1 -0
index 844b57f..cfc3f68 100644
@@ -8,6 +8,7 @@ enum omap_boot_src {
 	OMAP_BOOTSRC_UNKNOWN,
 	OMAP_BOOTSRC_MMC1,
 	OMAP_BOOTSRC_NAND,
+	OMAP_BOOTSRC_USB1,
 };
 
 enum omap_boot_src omap3_bootsrc(void);
arch/arm/mach-omap/omap4_generic.c +0 -0
index 617d786..55d8fe3 100644

arch/arm/mach-omap/omap4_generic.c enum omap_boot_src omap4_bootsrc(void) · line 487

Quoted 7 lines
arch/arm/mach-omap/omap4_generic.c +4 -0
@@ -481,6 +481,10 @@ enum omap_boot_src omap4_bootsrc(void)
 		return OMAP_BOOTSRC_MMC1;
 	if (bootsrc & (1 << 3))
 		return OMAP_BOOTSRC_NAND;
+#ifdef CONFIG_USB_BOOT
+	if (bootsrc & (1<<20))
+		return OMAP_BOOTSRC_USB1;
+#endif

This seems to be too early in the series, CONFIG_USB_BOOT is not yet introduced. You can drop the ifdef anyway, disabling CONFIG_USB_BOOT doesn't necessarily mean the SoC has not been booted from USB ;)

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
author
#7 lore raw

PATCH 4/7 Add USB booting capabilities to OMAP

In reply to vj
---
 arch/arm/cpu/cpu.c                              |   1 +
 arch/arm/lib/barebox.lds.S                      |  10 +
 arch/arm/mach-omap/Kconfig                      |  21 +
 arch/arm/mach-omap/Makefile                     |   1 +
 arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
 arch/arm/mach-omap/omap4_generic.c              |   2 +
 arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
 arch/arm/mach-omap/xload.c                      |  26 +
 scripts/.gitignore                              |   1 +
 scripts/Makefile                                |   3 +
 scripts/usbboot.c                               | 797 ++++++++++++++++++++++++
 11 files changed, 1197 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
 create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
 create mode 100644 scripts/usbboot.c
arch/arm/cpu/cpu.c +1 -0
index 71ef8c0..05343de 100644
@@ -89,6 +89,7 @@ void arch_shutdown(void)
 		: "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory"
 	);
 #endif
+	__asm__ __volatile__ ("cpsid i\n");
 }
 
 #ifdef CONFIG_THUMB2_BAREBOX
arch/arm/lib/barebox.lds.S +10 -0
index a69013f..ff7b63d 100644
@@ -97,6 +97,16 @@ SECTIONS
 	__bss_start = .;
 	.bss : { *(.bss*) }
 	__bss_stop = .;
+#ifdef CONFIG_SHARE_USB_HANDLE
+    /*
+     * Reserve space for the USB handle
+     */
+	. = CONFIG_USB_HANDLE_HANDOVER;
+	. = ALIGN(4);
+	__usb_handle = .;
+	/* . += sizeof(struct usb); */
+	. += 84;
+#endif
 	_end = .;
 	_barebox_image_size = __bss_start - TEXT_BASE;
 }
arch/arm/mach-omap/Kconfig +21 -0
index d735284..8e0a0b3 100644
@@ -96,6 +96,27 @@ config ARCH_TEXT_BASE
 	default 0x80e80000 if MACH_OMAP343xSDP
 	default 0x80e80000 if MACH_BEAGLE
 
+config USB_BOOT
+	bool "enable booting from USB"
+	default n
+	depends on ARCH_OMAP4
+	help
+	  Enable this to have USB booting
+
+config SHARE_USB_HANDLE
+	bool "share the usb handle"
+	default n
+	depends on USB_BOOT
+	help
+	  Enable this to share the usb handle between the xloader and the second stage bootloader.
+
+config USB_HANDLE_HANDOVER
+	hex "address where to put the usb handle"
+	default  0x4030BFAC
+	depends on SHARE_USB_HANDLE
+	help
+	  The Address where barebox will put the usb handle to be used in the second stage.
+
 config BOARDINFO
 	default "Texas Instrument's SDP343x" if MACH_OMAP343xSDP
 	default "Texas Instrument's Beagle" if MACH_BEAGLE
arch/arm/mach-omap/Makefile +1 -0
index f087f4b..8b35333 100644
@@ -30,4 +30,5 @@ obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
 obj-$(CONFIG_SHELL_NONE) += xload.o
 obj-$(CONFIG_I2C_TWL6030) += omap4_twl6030_mmc.o
+obj-$(CONFIG_USB_BOOT) += omap4_rom_usb.o
 obj-y += gpio.o
arch/arm/mach-omap/include/mach/omap4_rom_usb.h new file +146 -0

146 lines not on this page · raw message

arch/arm/mach-omap/omap4_generic.c +2 -0
index 55d8fe3..3e00d9f 100644
@@ -457,6 +457,7 @@ static int watchdog_init(void)
 }
 late_initcall(watchdog_init);
 
+#ifndef CONFIG_USB_BOOT
 static int omap_vector_init(void)
 {
 	__asm__ __volatile__ (
@@ -470,6 +471,7 @@ static int omap_vector_init(void)
 	return 0;
 }
 core_initcall(omap_vector_init);
+#endif
 
 #define OMAP4_TRACING_VECTOR3 0x4030d048
 
arch/arm/mach-omap/omap4_rom_usb.c new file +189 -0

189 lines not on this page · raw message

arch/arm/mach-omap/xload.c +26 -0
index 13024ab..36dfd26 100644
@@ -54,6 +54,26 @@ void *omap_xload_boot_mmc(void)
 	return buf;
 }
 
+#ifdef CONFIG_USB_BOOT
+void *omap_xload_boot_usb(){
+	int ret;
+	void *buf;
+	int len;
+
+	ret = mount("usbboot", "usbbootfs", "/");
+	if (ret) {
+		printf("Unable to mount usbbootfs (%d)\n", ret);
+		return NULL;
+	}
+
+	buf = read_file("/barebox.bin", &len);
+	if (!buf)
+		printf("could not read barebox.bin from usbbootfs\n");
+
+	return buf;
+}
+#endif
+
 enum omap_boot_src omap_bootsrc(void)
 {
 #if defined(CONFIG_ARCH_OMAP3)
@@ -76,6 +96,12 @@ int run_shell(void)
 		printf("booting from MMC1\n");
 		func = omap_xload_boot_mmc();
 		break;
+#ifdef CONFIG_USB_BOOT
+	case OMAP_BOOTSRC_USB1:
+		printf("booting from USB1\n");
+		func = omap_xload_boot_usb();
+		break;
+#endif
 	case OMAP_BOOTSRC_UNKNOWN:
 		printf("unknown boot source. Fall back to nand\n");
 	case OMAP_BOOTSRC_NAND:
scripts/.gitignore +1 -0
index 6e63f85..017c81c 100644
@@ -5,3 +5,4 @@ kallsyms
 mkimage
 mkublheader
 omap_signGP
+usbboot
scripts/Makefile +3 -0
index 7ca5e29..c8f68fb 100644
@@ -4,12 +4,15 @@
 # ---------------------------------------------------------------------------
 # kallsyms:      Find all symbols in barebox
 
+HOSTCFLAGS   += -lpthread
+
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-y                      += bin2c
 hostprogs-y                      += mkimage
 hostprogs-y                      += bareboxenv
 hostprogs-$(CONFIG_ARCH_NETX)    += gen_netx_image
 hostprogs-$(CONFIG_ARCH_OMAP)    += omap_signGP
+hostprogs-$(CONFIG_USB_BOOT)     += usbboot
 hostprogs-$(CONFIG_ARCH_S5PCxx)  += s5p_cksum
 hostprogs-$(CONFIG_ARCH_DAVINCI) += mkublheader
 
scripts/usbboot.c new file +797 -0

797 lines not on this page · raw message

Signature · 7 lines
1.7.12.1


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

Re: [PATCH 4/7] Add USB booting capabilities to OMAP

Quoted 37 lines · vj
---
 arch/arm/cpu/cpu.c                              |   1 +
 arch/arm/lib/barebox.lds.S                      |  10 +
 arch/arm/mach-omap/Kconfig                      |  21 +
 arch/arm/mach-omap/Makefile                     |   1 +
 arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
 arch/arm/mach-omap/omap4_generic.c              |   2 +
 arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
 arch/arm/mach-omap/xload.c                      |  26 +
 scripts/.gitignore                              |   1 +
 scripts/Makefile                                |   3 +
 scripts/usbboot.c                               | 797 ++++++++++++++++++++++++
 11 files changed, 1197 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
 create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
 create mode 100644 scripts/usbboot.c
arch/arm/cpu/cpu.c +1 -0
index 71ef8c0..05343de 100644
@@ -89,6 +89,7 @@ void arch_shutdown(void)
 		: "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory"
 	);
 #endif
+	__asm__ __volatile__ ("cpsid i\n");
 }
 
 #ifdef CONFIG_THUMB2_BAREBOX
arch/arm/lib/barebox.lds.S +0 -0
index a69013f..ff7b63d 100644
@@ -97,6 +97,16 @@ SECTIONS
 	__bss_start = .;
 	.bss : { *(.bss*) }
 	__bss_stop = .;

arch/arm/lib/barebox.lds.S SECTIONS · line 109

Quoted 10 lines
arch/arm/lib/barebox.lds.S +10 -0
+#ifdef CONFIG_SHARE_USB_HANDLE
+    /*
+     * Reserve space for the USB handle
+     */
+	. = CONFIG_USB_HANDLE_HANDOVER;
+	. = ALIGN(4);
+	__usb_handle = .;
+	/* . += sizeof(struct usb); */
+	. += 84;
+#endif

If I understand correctly the first stage loader puts some data here where a second stage barebox (configured with the same value for CONFIG_USB_HANDLE_HANDOVER) will pick it up.

This seems to be a bit fragile. Fortunately Jan has posted a series that gives the control of the reset vector to the boards, which means that both stages do not have to agree on an addres, but instead a pointer can be passed from the first to the second stage.

arch/arm/lib/barebox.lds.S SECTIONS · line 110

Quoted 1 line
arch/arm/lib/barebox.lds.S +1 -0
+int usb_open(void)

So this uses the OMAP4 ROM to do USB communication, right? The functions should have a omap_rom_* prefix then, otherwise it's not clear for a reader which context these functions have.

The calling of the ROM code btw explains why the setting of VBAR breaks USB boot. The ROM probably uses the vectors.

Quoted 5 lines
arch/arm/lib/barebox.lds.S +5 -0
+
+	n = rom_get_per_driver(&pusb->io, boot->device_type);
+	if (n)
+		return n;
+

arch/arm/lib/barebox.lds.S SECTIONS

Quoted 10 lines
arch/arm/lib/barebox.lds.S +10 -0
+	pusb->dread.xfer_mode = boot->xfer_mode;
+	pusb->dread.options = boot->options;
+	pusb->dread.device_type = boot->device_type;
+
+	pusb->dwrite.xfer_mode = boot->xfer_mode;
+	pusb->dwrite.options = boot->options;
+	pusb->dwrite.device_type = boot->device_type;
+#else
+#ifdef CONFIG_MMU
+#error USB communications not working under MMU

You can add the following to CONFIG_OMAP4_USB_BOOT instead:

depends on !MMU

So that an invalid config is not allowed in the first place.

scripts/usbboot.c

Quoted 1 line
scripts/usbboot.c +0 -0

This should also be named omap4-usbboot.c, or maybe, if the works on other OMAPs, just omap-usboot.c

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
author
#9 lore raw

Re: [PATCH 4/7] Add USB booting capabilities to OMAP

Hi Sascha,
I've been playing with passing some data from first to second stage using
Jan's patches.
It worked fine, but in my case I want to store this data on a global variable, which is cleared as it's in the BSS.
There is a clean workarround to this issue?

Thanks,
Vicente.

Quoted 97 lines · Sascha Hauer
Quoted 4 lines · vj
---
 arch/arm/cpu/cpu.c                              |   1 +
 arch/arm/lib/barebox.lds.S                      |  10 +
 arch/arm/mach-omap/Kconfig                      |  21 +
Quoted 8 lines
 arch/arm/mach-omap/Makefile                     |   1 +
 arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
 arch/arm/mach-omap/omap4_generic.c              |   2 +
 arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
 arch/arm/mach-omap/xload.c                      |  26 +
 scripts/.gitignore                              |   1 +
 scripts/Makefile                                |   3 +
 scripts/usbboot.c                               | 797

++++++++++++++++++++++++

arch/arm/cpu/cpu.c void arch_shutdown(void) · line 89

Quoted 11 lines
 11 files changed, 1197 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
 create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
 create mode 100644 scripts/usbboot.c
arch/arm/cpu/cpu.c +0 -0
index 71ef8c0..05343de 100644
@@ -89,6 +89,7 @@ void arch_shutdown(void)
              : "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc",

"memory"

Quoted 14 lines
arch/arm/cpu/cpu.c +1 -0
      );
 #endif
+     __asm__ __volatile__ ("cpsid i\n");
 }
 
 #ifdef CONFIG_THUMB2_BAREBOX
arch/arm/lib/barebox.lds.S +0 -0
index a69013f..ff7b63d 100644
@@ -97,6 +97,16 @@ SECTIONS
      __bss_start = .;
      .bss : { *(.bss*) }
      __bss_stop = .;

arch/arm/lib/barebox.lds.S SECTIONS · line 109

Quoted 10 lines
arch/arm/lib/barebox.lds.S +10 -0
+#ifdef CONFIG_SHARE_USB_HANDLE
+    /*
+     * Reserve space for the USB handle
+     */
+     . = CONFIG_USB_HANDLE_HANDOVER;
+     . = ALIGN(4);
+     __usb_handle = .;
+     /* . += sizeof(struct usb); */
+     . += 84;
+#endif

If I understand correctly the first stage loader puts some data here where a second stage barebox (configured with the same value for CONFIG_USB_HANDLE_HANDOVER) will pick it up.

This seems to be a bit fragile. Fortunately Jan has posted a series that gives the control of the reset vector to the boards, which means that both stages do not have to agree on an addres, but instead a pointer can be passed from the first to the second stage.

arch/arm/lib/barebox.lds.S SECTIONS · line 110

Quoted 1 line
arch/arm/lib/barebox.lds.S +1 -0
+int usb_open(void)

So this uses the OMAP4 ROM to do USB communication, right? The functions should have a omap_rom_* prefix then, otherwise it's not clear for a reader which context these functions have.

The calling of the ROM code btw explains why the setting of VBAR breaks USB boot. The ROM probably uses the vectors.

Quoted 5 lines
arch/arm/lib/barebox.lds.S +5 -0
+
+     n = rom_get_per_driver(&pusb->io, boot->device_type);
+     if (n)
+             return n;
+

arch/arm/lib/barebox.lds.S SECTIONS

Quoted 10 lines
arch/arm/lib/barebox.lds.S +10 -0
+     pusb->dread.xfer_mode = boot->xfer_mode;
+     pusb->dread.options = boot->options;
+     pusb->dread.device_type = boot->device_type;
+
+     pusb->dwrite.xfer_mode = boot->xfer_mode;
+     pusb->dwrite.options = boot->options;
+     pusb->dwrite.device_type = boot->device_type;
+#else
+#ifdef CONFIG_MMU
+#error USB communications not working under MMU

You can add the following to CONFIG_OMAP4_USB_BOOT instead:

depends on !MMU

So that an invalid config is not allowed in the first place.

scripts/usbboot.c

Quoted 1 line
scripts/usbboot.c +0 -0

This should also be named omap4-usbboot.c, or maybe, if the works on other OMAPs, just omap-usboot.c

Quoted 8 lines

Sascha

--

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

#10 lore raw

Re: [PATCH 4/7] Add USB booting capabilities to OMAP

Quoted 6 lines · vj

Hi Sascha,
I've been playing with passing some data from first to second stage using
Jan's patches.
It worked fine, but in my case I want to store this data on a global variable, which is cleared as it's in the BSS.
There is a clean workarround to this issue?

The workaound would be to initialize the variable so it can't be in bss. I'm still looking for a better way to do 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
author
#11 lore raw

PATCH 5/7 add console support over the same USB used for booting

In reply to vj
---
 drivers/serial/Kconfig      |  7 +++++
 drivers/serial/Makefile     |  1 +
 drivers/serial/serial_usb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 drivers/serial/serial_usb.c
drivers/serial/Kconfig +7 -0
index 7eb96ed..4e85e1f 100644
@@ -100,4 +100,11 @@ config DRIVER_SERIAL_PXA
 	bool "PXA serial driver"
 	depends on ARCH_PXA
 
+config DRIVER_SERIAL_USB
+	bool "serial driver over omap4 usb"
+	default n
+	depends on USB_BOOT
+	help
+	  Enable this to get console support over the usb bus used to boot an OMAP4
+
 endmenu
drivers/serial/Makefile +1 -0
index e2d56b9..a89bb44 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_DRIVER_SERIAL_S3C)			+= serial_s3c.o
 obj-$(CONFIG_DRIVER_SERIAL_ALTERA)		+= serial_altera.o
 obj-$(CONFIG_DRIVER_SERIAL_ALTERA_JTAG)		+= serial_altera_jtag.o
 obj-$(CONFIG_DRIVER_SERIAL_PXA)			+= serial_pxa.o
+obj-$(CONFIG_DRIVER_SERIAL_USB)			+= serial_usb.o
drivers/serial/serial_usb.c new file +64 -0

64 lines not on this page · raw message

Signature · 7 lines
1.7.12.1


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

PATCH 6/7 add filesystem support over the same USB used for booting

In reply to vj
---
 fs/Kconfig     |   5 ++
 fs/Makefile    |   1 +
 fs/usbbootfs.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 201 insertions(+)
 create mode 100644 fs/usbbootfs.c
fs/Kconfig +5 -0
index 4c66543..1b89aec 100644
@@ -29,6 +29,11 @@ config FS_TFTP
 	prompt "tftp support"
 	depends on NET
 
+config FS_USBBOOT
+	bool
+	prompt "Filesystem over usb boot"
+	depends on USB_BOOT
+
 config FS_NFS
 	depends on NET
 	bool
fs/Makefile +1 -0
index 1b52bee..d4f9a59 100644
@@ -5,4 +5,5 @@ obj-$(CONFIG_FS_DEVFS)	+= devfs.o
 obj-$(CONFIG_FS_FAT)	+= fat/
 obj-y	+= fs.o
 obj-$(CONFIG_FS_TFTP)	+= tftp.o
+obj-$(CONFIG_FS_USBBOOT)	+= usbbootfs.o
 obj-$(CONFIG_FS_NFS)	+= nfs.o
fs/usbbootfs.c new file +195 -0

195 lines not on this page · raw message

Signature · 7 lines
1.7.12.1


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

PATCH 7/7 Add support for Archos G9 tablet

In reply to vj
---
 arch/arm/Makefile                         |   1 +
 arch/arm/boards/archosg9/Makefile         |   1 +
 arch/arm/boards/archosg9/board.c          |  58 ++++++++
 arch/arm/boards/archosg9/env/bin/init     |  18 +++
 arch/arm/boards/archosg9/env/config       |   2 +
 arch/arm/boards/archosg9/lowlevel.c       | 126 +++++++++++++++++
 arch/arm/boards/archosg9/mux.c            | 226 ++++++++++++++++++++++++++++++
 arch/arm/configs/archosg9_defconfig       |  70 +++++++++
 arch/arm/configs/archosg9_xload_defconfig |  25 ++++
 arch/arm/mach-omap/Kconfig                |   9 ++
 arch/arm/tools/mach-types                 |   1 +
 11 files changed, 537 insertions(+)
 create mode 100644 arch/arm/boards/archosg9/Makefile
 create mode 100644 arch/arm/boards/archosg9/board.c
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/config
 create mode 100644 arch/arm/boards/archosg9/lowlevel.c
 create mode 100644 arch/arm/boards/archosg9/mux.c
 create mode 100644 arch/arm/configs/archosg9_defconfig
 create mode 100644 arch/arm/configs/archosg9_xload_defconfig
arch/arm/Makefile +1 -0
index 8e660be..8598005 100644
@@ -100,6 +100,7 @@ board-$(CONFIG_MACH_OMAP343xSDP)		:= omap343xdsp
 board-$(CONFIG_MACH_BEAGLE)			:= beagle
 board-$(CONFIG_MACH_OMAP3EVM)			:= omap3evm
 board-$(CONFIG_MACH_PANDA)			:= panda
+board-$(CONFIG_MACH_ARCHOSG9)			:= archosg9
 board-$(CONFIG_MACH_PCM049)			:= pcm049
 board-$(CONFIG_MACH_PCA100)			:= phycard-i.MX27
 board-$(CONFIG_MACH_PCAAL1)			:= phycard-a-l1
arch/arm/boards/archosg9/Makefile new file +1 -0
new file mode 100644
index 0000000..c55e26e
@@ -0,0 +1 @@
+obj-y += board.o lowlevel.o mux.o
arch/arm/boards/archosg9/board.c new file +58 -0

58 lines not on this page · raw message

arch/arm/boards/archosg9/env/bin/init new file +18 -0
new file mode 100644
index 0000000..4c0f244
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+
+if [ -n $autoboot_timeout ]; then
+	echo
+	echo -n "Hit any key to stop autoboot: "
+	timeout -a $autoboot_timeout
+	if [ $? != 0 ]; then
+		exit
+	fi
+fi
+mkdir /usb
+mount -t usbbootfs usbboot /usb
+bootm /usb/boot/zImage
arch/arm/boards/archosg9/env/config new file +2 -0
new file mode 100644
index 0000000..9e8c1db
@@ -0,0 +1,2 @@
+autoboot_timeout=3
+bootargs="earlyprintk=serial console=ttyO1,57600n8"
arch/arm/boards/archosg9/lowlevel.c new file +126 -0

126 lines not on this page · raw message

arch/arm/boards/archosg9/mux.c new file +226 -0

226 lines not on this page · raw message

arch/arm/configs/archosg9_defconfig new file +70 -0

70 lines not on this page · raw message

arch/arm/configs/archosg9_xload_defconfig new file +25 -0
new file mode 100644
index 0000000..6186011
@@ -0,0 +1,25 @@
+CONFIG_MACH_ARCHOSG9=y
+CONFIG_ARCH_OMAP=y
+CONFIG_ARCH_OMAP4=y
+# CONFIG_OMAP_GPMC is not set
+CONFIG_OMAP_BUILD_IFT=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0xC000
+CONFIG_AEABI=y
+CONFIG_USB_BOOT=y
+CONFIG_SHARE_USB_HANDLE=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+CONFIG_TEXT_BASE=0x40300000
+CONFIG_MEMORY_LAYOUT_FIXED=y
+CONFIG_STACK_BASE=0x8f000000
+CONFIG_MALLOC_BASE=0x84000000
+CONFIG_MALLOC_SIZE=0x2000000
+CONFIG_SHELL_NONE=y
+# CONFIG_ERRNO_MESSAGES is not set
+# CONFIG_TIMESTAMP is not set
+# CONFIG_CONSOLE_FULL is not set
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_DRIVER_SERIAL_USB=y
+# CONFIG_SPI is not set
+# CONFIG_FS_RAMFS is not set
+# CONFIG_FS_DEVFS is not set
+CONFIG_FS_USBBOOT=y
arch/arm/mach-omap/Kconfig +9 -0
index 8e0a0b3..464c8a4 100644
@@ -125,6 +125,7 @@ config BOARDINFO
 	default "Phytec phyCORE pcm049" if MACH_PCM049
 	default "Phytec phyCARD-A-L1" if MACH_PCAAL1
 	default "Phytec phyCARD-A-XL2" if MACH_PCAAXL2
+	default "Archos G9" if MACH_ARCHOSG9
 
 choice
 	prompt "Select OMAP board"
@@ -160,6 +161,14 @@ config MACH_PANDA
 	help
 	  Say Y here if you are using OMAP4 Panda board
 
+config MACH_ARCHOSG9
+	bool "Archos G9 tablets"
+	select HAVE_NOSHELL
+	select MACH_HAS_LOWLEVEL_INIT
+	depends on ARCH_OMAP4
+	help
+	  Say Y here if you are using OMAP4-based Archos G9 tablet
+
 config MACH_PCM049
 	bool "Phytec phyCORE pcm049"
 	select HAVE_NOSHELL
arch/arm/tools/mach-types +1 -0
index 325513f..a21da3b 100644
@@ -4148,3 +4148,4 @@ msm8625_evt		MACH_MSM8625_EVT	MSM8625_EVT		4193
 mx53_sellwood		MACH_MX53_SELLWOOD	MX53_SELLWOOD		4194
 somiq_am35		MACH_SOMIQ_AM35		SOMIQ_AM35		4195
 somiq_am37		MACH_SOMIQ_AM37		SOMIQ_AM37		4196
+omap4_archosg9		MACH_OMAP4_ARCHOSG9	OMAP4_ARCHOSG9		5032
Signature · 7 lines
1.7.12.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw
In reply to vj

Hi!

You have did a good job!

But please check your patch series with the scripts/checkpatch.pl script before submiting it to the maillist.

Quoted 88 lines · vj

Hello,
A this is my first contribution, so I'm basically requesting for comments.

The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu.
The tablet by default only boots from internal flash, so to test barebox on it a hardware tweak is required: change the sys_boot configuration. Once done the tablet can be booted with the following command:
A sudo scripts/usbboot <first_stage> <rootfs>

The patch contains
A 1.- specific changes for OMAP4460
A 2.- support for usb-booting
A 3.- support for console on usb
A 4.- support for file transfer through usb
A 5.- some minor bug fixes
A 6.- adds support for archosg9 board

A question I have is what does omap_vector_init do?
It breaks usb-booting.
An improvement to be done would be to split the file "scripts/usbboot.c" into a header and two c files, but the Makefile framework seemed to me to do not allow that.

In any case the patch should be tested with other boards to check it does not breaks something.

vj (7):
Improved an error message and solved a minor bug added debug info for twl6030
OMAP specific changes
Add USB booting capabilities to OMAP
add console support over the same USB used for booting add filesystem support over the same USB used for booting Add support for Archos G9 tablet

 arch/arm/Makefile                               |   1 +
 arch/arm/boards/archosg9/Makefile               |   1 +
 arch/arm/boards/archosg9/board.c                |  58 ++
 arch/arm/boards/archosg9/env/bin/init           |  18 +
 arch/arm/boards/archosg9/env/config             |   2 +
 arch/arm/boards/archosg9/lowlevel.c             | 126 ++++
 arch/arm/boards/archosg9/mux.c                  | 226 +++++++
 arch/arm/configs/archosg9_defconfig             |  70 +++
 arch/arm/configs/archosg9_xload_defconfig       |  25 +
 arch/arm/cpu/cpu.c                              |   1 +
 arch/arm/lib/armlinux.c                         |   2 +-
 arch/arm/lib/barebox.lds.S                      |  10 +
 arch/arm/mach-omap/Kconfig                      |  30 +
 arch/arm/mach-omap/Makefile                     |   1 +
 arch/arm/mach-omap/include/mach/omap4-mux.h     |  80 ++-
 arch/arm/mach-omap/include/mach/omap4-silicon.h |  13 +
 arch/arm/mach-omap/include/mach/omap4_rom_usb.h | 146 +++++
 arch/arm/mach-omap/include/mach/xload.h         |   1 +
 arch/arm/mach-omap/omap4_generic.c              |   6 +
 arch/arm/mach-omap/omap4_rom_usb.c              | 189 ++++++
 arch/arm/mach-omap/xload.c                      |  26 +
 arch/arm/tools/mach-types                       |   1 +
 drivers/mci/omap_hsmmc.c                        |   2 +-
 drivers/mfd/twl6030.c                           |  13 +
 drivers/serial/Kconfig                          |   7 +
 drivers/serial/Makefile                         |   1 +
 drivers/serial/serial_usb.c                     |  64 ++
 fs/Kconfig                                      |   5 +
 fs/Makefile                                     |   1 +
 fs/usbbootfs.c                                  | 195 ++++++
 include/mfd/twl6030.h                           |   8 +
 scripts/.gitignore                              |   1 +
 scripts/Makefile                                |   3 +
 scripts/usbboot.c                               | 797 ++++++++++++++++++++++++
 34 files changed, 2100 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/Makefile
 create mode 100644 arch/arm/boards/archosg9/board.c
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/config
 create mode 100644 arch/arm/boards/archosg9/lowlevel.c
 create mode 100644 arch/arm/boards/archosg9/mux.c
 create mode 100644 arch/arm/configs/archosg9_defconfig
 create mode 100644 arch/arm/configs/archosg9_xload_defconfig
 create mode 100644 arch/arm/mach-omap/include/mach/omap4_rom_usb.h
 create mode 100644 arch/arm/mach-omap/omap4_rom_usb.c
 create mode 100644 drivers/serial/serial_usb.c
 create mode 100644 fs/usbbootfs.c
 create mode 100644 scripts/usbboot.c

--
1.7.12.1

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

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#15 lore raw
In reply to vj
Quoted 4 lines · vj

Hello,
A this is my first contribution, so I'm basically requesting for comments.

The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu.

Nice :)
I should have bought that one instead of a Acer.

Quoted 3 lines

A question I have is what does omap_vector_init do? It breaks usb-booting.

I digged around a bit. The funny thing is that this was introduced with OMAP4 support and is only done on OMAP4. U-Boot instead has the following:

Quoted 16 lines

#if !defined(CONFIG_TEGRA2)
/*
* Setup vector:
* (OMAP4 spl TEXT_BASE is not 32 byte aligned.
* Continue to use ROM code vector only in OMAP4 spl) */

#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))
	/* Set V=0 in CP15 SCTRL register - for VBAR to point to vector
 * */
	mrc	p15, 0, r0, c1, c0, 0	@ Read CP15 SCTRL Register
	bic	r0, #CR_V		@ V = 0
	mcr	p15, 0, r0, c1, c0, 0	@ Write CP15 SCTRL Register

	/* Set vector address in CP15 VBAR register */
	ldr	r0, =_start
	mcr	p15, 0, r0, c12, c0, 0	@Set VBAR
Quoted 2 lines

#endif
#endif /* !Tegra2 */

So in U-Boot it's done for every ARMv7 *except* OMAP4 (and Tegra)

ARM has this information about it:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0434b/CIHHDAIH.html

Quoted 11 lines

Purpose

Provides the exception base address for exceptions that are not handled in monitor mode.

Usage constraints

The VBAR is:

* only accessible in privileged modes
* only accessible in Secure state.

I think this is necessary to move the exception vector from ROM to our own code. Does it work to read the VBAR register using the following instruction:

	MRC p15, 0, <Rd>, c12, c0, 0 ; Read VBAR Register

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
author
#16 lore raw

Hi Sascha,
I'm not an expert in ARM assembly, so, if this is correct:

    u32 r=0;
    asm ("mrc p15, 0, %0, c12, c0, 0" : "=r" (r));
    printf("MRC p15, 0, <Rd>, c12, c0, 0 returns 0x%08X\n", r);
    r=-1;
    asm ("mrc p15, 0, %0, c12, c0, 0" : "=r" (r));
    printf("MRC p15, 0, <Rd>, c12, c0, 0 returns 0x%08X\n", r);
the return value is:
    MRC p15, 0, <Rd>, c12, c0, 0 returns 0x00030000
    MRC p15, 0, <Rd>, c12, c0, 0 returns 0x00030000

Which is the base address of "ROM exception vectors" and the address of the "Reset" exception vector.
This is the value when omap_vector_init is disabled.

Hope this helps,
Vicente.

Quoted 63 lines · Sascha Hauer
Quoted 2 lines · vj

Hello,
A this is my first contribution, so I'm basically requesting for

comments.

Quoted 2 lines

The attached patch adds support for Archos G9 tablet wich uses an

OMAP4460 cpu.

Nice :)
I should have bought that one instead of a Acer.

Quoted 3 lines

A question I have is what does omap_vector_init do? It breaks usb-booting.

I digged around a bit. The funny thing is that this was introduced with OMAP4 support and is only done on OMAP4. U-Boot instead has the following:

Quoted 13 lines

#if !defined(CONFIG_TEGRA2)
/*
* Setup vector:
* (OMAP4 spl TEXT_BASE is not 32 byte aligned.
* Continue to use ROM code vector only in OMAP4 spl) */

#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))
      /* Set V=0 in CP15 SCTRL register - for VBAR to point to vector
 * */
      mrc     p15, 0, r0, c1, c0, 0   @ Read CP15 SCTRL Register
      bic     r0, #CR_V               @ V = 0
      mcr     p15, 0, r0, c1, c0, 0   @ Write CP15 SCTRL Register
Quoted 5 lines
      /* Set vector address in CP15 VBAR register */
      ldr     r0, =_start
      mcr     p15, 0, r0, c12, c0, 0  @Set VBAR

#endif
#endif /* !Tegra2 */

So in U-Boot it's done for every ARMv7 *except* OMAP4 (and Tegra)

ARM has this information about it:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0434b/CIHHDAIH.html

Quoted 11 lines

Purpose

Provides the exception base address for exceptions that are not handled in monitor mode.

Usage constraints

The VBAR is:

* only accessible in privileged modes
* only accessible in Secure state.

I think this is necessary to move the exception vector from ROM to our own code. Does it work to read the VBAR register using the following instruction:

        MRC p15, 0, <Rd>, c12, c0, 0 ; Read VBAR Register
Quoted 8 lines

Sascha

--

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

#17 lore raw
In reply to vj
Quoted 18 lines · vj

Hello,
A this is my first contribution, so I'm basically requesting for comments.

The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu. The tablet by default only boots from internal flash, so to test barebox on it a hardware tweak is required: change the sys_boot configuration. Once done the tablet can be booted with the following command:
A sudo scripts/usbboot <first_stage> <rootfs>

The patch contains
A 1.- specific changes for OMAP4460
A 2.- support for usb-booting
A 3.- support for console on usb
A 4.- support for file transfer through usb
A 5.- some minor bug fixes
A 6.- adds support for archosg9 board

Quoted 8 lines

A question I have is what does omap_vector_init do?
It breaks usb-booting.
An improvement to be done would be to split the file "scripts/usbboot.c" into a header and two c files, but the Makefile framework seemed to me to do not allow that.

In any case the patch should be tested with other boards to check it does not breaks something.

This is very interesting stuff indeed.

Now that I read through the series I can say that the biggest single problem with it is the missing context of filenames and function names. All OMAP specific stuff should have a omap_ or omap4_ prefix.

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