Re: [U-Boot] [PATCH v2 1/2] ubi: Only read the actual size of the VID header
On 11/05/2012 05:46 PM, Joe Hershberger wrote: If sub-page reads are supported, this will save reading unneeded data Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- drivers/mtd/ubi/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 8423894..23660e3 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -916,7 +916,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, p = (char *)vid_hdr - ubi-vid_hdr_shift; err = ubi_io_read(ubi, p, pnum, ubi-vid_hdr_aloffset, - ubi-vid_hdr_alsize); + UBI_VID_HDR_SIZE); if (err) { if (err != UBI_IO_BITFLIPS err != -EBADMSG) return err; Joe, are you pushing this change to Linux as well? I would really like to see Artem commenting on this. Thanks, Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] SMSC LAN9514 on TI DM37x board
Hi Marek, On 11/06/2012 12:57 AM, Marek Vasut wrote: Can you please avoid top-posting? Does U-Boot even support your USB device? Sorry about top-posting. My USB device is supported by smsc95xx.c driver in drivers/usb/eth. Thanks a lot. Felix. On 11/02/2012 08:38 AM, Felix Radensky wrote: Hi, I'm running u-boot-2012.10 on a custom DM37x based board. The board has LAN9514 USB Ethernet adapter connected in EHCI host controller via USB3320 ULPI PHY. This is very similar to BeagleBoard XM. Both Ethernet and USB hub work in linux-2.6.37 from TI PSP 04.02.00.07. In u-boot however, neither Ethernet nor mass storage devices attached to hub are not detected. Below is boot log: U-Boot 2012.10 (Nov 02 2012 - 00:44:41) OMAP36XX/37XX-GP ES1.2, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz Pro4Tech MVC404 board + LPDDR/NAND I2C: ready DRAM: 256 MiB NAND: 512 MiB MMC: OMAP SD/MMC: 0 In:serial Out: serial Err: serial Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 MVC404 usb start (Re)start USB... USB: Register 1313 NbrPorts 3 USB EHCI 1.00 scanning bus for devices... 1 USB Device(s) found scanning bus for storage devices... 0 Storage Device(s) found scanning bus for ethernet devices... 0 Ethernet Device(s) found MVC404 usb info 1: Hub, USB Revision 2.0 - u-boot EHCI Host Controller - Class: Hub - PacketSize: 64 Configurations: 1 - Vendor: 0x Product 0x Version 1.0 Configuration: 1 - Interfaces: 1 Self Powered 0mA Interface: 0 - Alternate Setting 0, Endpoints: 1 - Class Hub - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms I have the following definitions in the code: #define CONFIG_USB_OMAP3 #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_OMAP #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS3 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO24 #define CONFIG_USB_ULPI #define CONFIG_USB_ULPI_VIEWPORT_OMAP #define CONFIG_USB_STORAGE static struct omap_usbhs_board_data usbhs_bdata = { .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED }; MUX_VAL(CP(ETK_D15_ES2),(IDIS | PTD | DIS | M4)) /*GPIO_24*/ I'd appreciate any help in fixing the problem. Thanks. Felix Radensky. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot Felix. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] UBIFS fails on SheevaPlug
Dear Dimax, On 06.11.2012 08:51, Dimax wrote: Well so far no luck, Actually I'm not sure how to start. But I will try to go on with a little help from my friends. I) The first question that raised is a compiler. I see two options: 1. Use the cross compiler - this is what more likely most of the people are doing. 2. I wonder if I can use native compiler? I actually have a number of running SheevaPlugs with gcc installed on them. Do you think it will work? Both should work, if you need an cross compiler have a look at ELDK [1] II) After extracting files I have following tree: u-boot_2012.04.01-2_armel.deb Wrong file! Please use the source from denx.de, either git from git://git.denx.de/u-boot.git or a released version from ftp://ftp.denx.de/pub/u-boot snip debian package content According to README all I have to do is to run make NAME_config The sheevaplug is listed in boards.cfg so there should be no problem to make sheevaplug_config. Thats true for native build (never tested, may not work) You will need some compiler flags: CROSS_COMPILE (prefix for 'gcc' when cross compiling) PATH (should contain your toolchain) I would build it that way: ---8--- abiessmann@azuregos % PATH=$ARMv5_PATH:$PATH CROSS_COMPILE=arm-v5te-linux-gnueabi- make O=/tmp/build_sheevaplug sheevaplug_config Configuring for sheevaplug board... abiessmann@azuregos % PATH=$ARMv5_PATH:$PATH CROSS_COMPILE=arm-v5te-linux-gnueabi- make O=/tmp/build_sheevaplug all ... abiessmann@azuregos % ls -l /tmp/build_sheevaplug/u-boot* -rwxr-xr-x 1 abiessmann abiessmann 1893165 Nov 6 10:09 /tmp/build_sheevaplug/u-boot* -rw-r--r-- 1 abiessmann abiessmann 378492 Nov 6 10:09 /tmp/build_sheevaplug/u-boot.bin -rw-r--r-- 1 abiessmann abiessmann1043 Nov 6 10:09 /tmp/build_sheevaplug/u-boot.lds -rw-r--r-- 1 abiessmann abiessmann 127109 Nov 6 10:09 /tmp/build_sheevaplug/u-boot.map -rw-r--r-- 1 abiessmann abiessmann 1088268 Nov 6 10:09 /tmp/build_sheevaplug/u-boot.srec abiessmann@azuregos % PATH=$ARMv5_PATH:$PATH CROSS_COMPILE=arm-v5te-linux-gnueabi- make O=/tmp/build_sheevaplug /tmp/build_sheevaplug/u-boot.kwb ... Preparing kirkwood boot image to boot from nand Nand ECC mode = default Nand page size = 0x800 Image Type: Kirkwood Boot from NAND Flash Image Data Size:378492 Bytes = 369.62 kB = 0.36 MB Load Address: 0060 Entry Point: 0060 ---8--- In this case I do not get what are the other two directory and file: u-boot_2012.04.01-2_armel.deb debian/ To my understanding debian/ is some port but I do not see any makefile where. So not sure hot to use it? Well, that is a pre-compiled debian package for armel. The debian directory contains some information for the debian package system. Best regards Andreas Bießmann [1] http://www.denx.de/wiki/DULG/ELDK ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PULL] please pull u-boot-atmel/master
Hi Albert, On 05.11.2012 14:09, Albert ARIBAUD wrote: Hi Andreas, On Mon, 5 Nov 2012 11:19:30 +0100, Andreas Bießmann andreas.de...@googlemail.com wrote: Dear Albert Aribaud, The following changes since commit 46d626d3926cf6b9f9c477782c5a0ee620a424cd: socfpga/spl: Remove malloc.h (2012-11-04 16:23:23 +0100) are available in the git repository at: git://git.denx.de/u-boot-atmel.git master for you to fetch changes up to 15915a45d438b9e65e03c3052c3dbab1374927bc: at91: move get_chip_id() and get_extension_chip_id() to cpu.c, which can share with all at91 board. (2012-11-05 11:15:12 +0100) Bo Shen (1): video: atmel: implement lcd_setcolreg funtion What is the point of adding this function? This does not seem to be a strong override of a weak symbol, and therefore, it is dead code unless this patch is a dependency of one or several other patches -- in which case, please submit the other patch(es) along this one in your PR. This one is required for http://patchwork.ozlabs.org/patch/196566/ and was explicitly requested in a private mail to Bo to support for getting the RFC working (http://article.gmane.org/gmane.comp.boot-loaders.u-boot/145434). So you are right here, currently it is dead code and could maybe added to a series. On the other hand the lcd_setcolreg() is exported via include/lcd.h but not provided by the atmel_hlcd driver which is an error. Wu, Josh (1): at91: move get_chip_id() and get_extension_chip_id() to cpu.c, which can share with all at91 board. This one, despite being a cleaner rewrite, also seems to be a preparatory patch waiting to be used. Well, the get_*chip_id() are already used by some macros but only for a single variant of at91. So you are right here when you call it 'preparatory', but it is not dead code as you may think. The whole PR is dead/dormant code. Please resubmit when dependent patches are added (or consider rolling back your master until you get these dependent patches). However I rolled back the u-boot-atmel/master and will provide a series for patch 1, patch 2 is so far NAKed until we get a user for that reworked code. Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] at91: move get_chip_id() and get_extension_chip_id() to cpu.c, which can share with all at91 board.
Dear Josh Wu, On 05.11.2012 11:18, Andreas Bießmann wrote: Dear Josh Wu, On 01.11.2012 11:57, Josh Wu wrote: Signed-off-by: Josh Wu josh...@atmel.com --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 12 arch/arm/cpu/arm926ejs/at91/cpu.c| 11 +++ arch/arm/include/asm/arch-at91/at91_dbu.h|4 arch/arm/include/asm/arch-at91/at91sam9x5.h |1 - 4 files changed, 15 insertions(+), 13 deletions(-) applied to u-boot-atmel/master, thanks! Patch was removed from u-boot-atmel cause of a NAK from ARM custodian. Please read http://article.gmane.org/gmane.comp.boot-loaders.u-boot/146403 and provide a user for the moved functions. Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] video: atmel: implement lcd_setcolreg funtion
Dear Bo Shen, On 05.11.2012 10:38, Andreas Bießmann wrote: Dear Bo Shen, On 29.10.2012 08:00, Bo Shen wrote: Signed-off-by: Bo Shen voice.s...@atmel.com --- drivers/video/atmel_hlcdfb.c |6 ++ 1 file changed, 6 insertions(+) Applied to u-boot-atmel/master, thanks! Patch was removed from u-boot-atmel/master due to NAK from ARM custodian. Please read http://article.gmane.org/gmane.comp.boot-loaders.u-boot/146403 I will take your patch and send a series with the common/lcd.c changes to the list. Best regards Andreas Bießmann ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] generic mmc bug in reading sd card capacity
On 2012-11-02, victor vic...@keyasic.com wrote: Hi All, Accord to SD spec 2.0, the formula to find out sd card capacity is: memory capacity = (C_SIZE+1) * 512K byte and C_SIZE is from CSD [69:48] Thus, the code in generic mmc is wrong for the high capacity sd card. My patch is below. We should be careful about the fact that this only works for SD cards. The size parameter is handled differently on MMC devices larger than 2 GiB. What do you think of the following patch: (Compile tested only, I do not have a board available for testing right now) 8-- From 206b32c0bc90972b3dab2fe7ef902a451fc8e7b6 Mon Sep 17 00:00:00 2001 From: Romain Izard romain.izard@gmail.com Date: Mon, 5 Nov 2012 10:52:56 +0100 Subject: [PATCH] mmc: Correct computing the SD capacity For high-capacity SD cards, the block size is not used to compute the effective card capacity. Since high capacity MMC cards do not use the same method, high-capacity SD cards must be adressed separately. Signed-off-by: Romain Izard romain.izard@gmail.com --- drivers/mmc/mmc.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5ffd8c5..209a200 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -976,19 +976,18 @@ static int mmc_startup(struct mmc *mmc) else mmc-write_bl_len = 1 ((cmd.response[3] 22) 0xf); - if (mmc-high_capacity) { + if (IS_SD(mmc) mmc-high_capacity) { csize = (mmc-csd[1] 0x3f) 16 | (mmc-csd[2] 0x) 16; - cmult = 8; + mmc-capacity = (csize + 1) 19; } else { csize = (mmc-csd[1] 0x3ff) 2 | (mmc-csd[2] 0xc000) 30; cmult = (mmc-csd[2] 0x00038000) 15; + mmc-capacity = (csize + 1) (cmult + 2); + mmc-capacity *= mmc-read_bl_len; } - mmc-capacity = (csize + 1) (cmult + 2); - mmc-capacity *= mmc-read_bl_len; - if (mmc-read_bl_len 512) mmc-read_bl_len = 512; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] USB mass storage gadget patch
Lukasz, Hi victor, Regarding UMS support: The last version posted at u-boot ML can be found at [**]: http://thread.gmane.org/gmane.comp.boot-loaders.u- boot/113004/match=ums +if (fsg_fs_bulk_out_desc.bEndpointAddress != 0x1) + fsg_fs_bulk_out_desc.bEndpointAddress = 0x1; + If possible, please align to patch set [**], so we can have the same setup. However, I will try to find some time to help you with the problem (that's why I've asked for description of the problem, which you are trying to fix). I hardcode bulk out endpoint to EP1 because the hardware only got one endpoint. So the code has to use EP1 for both bulk in and bulk out data transfer. Will this break the usb mass storage gadget code? I will get the file_storage.c from [**]. The short description of the problem: The U-boot usb mass storage gadget driver has problem with buffer management, sometimes the buffer returned by IRQ routine and the get_next_command function are different. It causes problem in processing SCSI_MODE_SELECT_6 command. The detailed description of the problem: When receiving the SCSI_MODE_SELECT_6 command, in bulk_out_complete(), the bh pointer is 0x1b872e4. Then, in get_next_command(), before calling start_transfer(), the bh pointer becomes 0x1b87304. This changes in bh pointer can cause data not to be processed by the usb mass storage gadget code. Thanks, Victor CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and may be protected by legal privilege. If you are not the intended addressee (or authorized to receive for the addressee). be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you for your cooperation. KeyASIC Inc. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/2] rework common/lcd
This series rework the CLUT management in common/lcd and use the driver API lcd_setcolreg() for that. The change was first requested from Marek Vasut due to a compiler warning (type-punned pointer stuff) encountered with eldk 4.2 and introduced in 203c37b8c5556aad1901ce4954792afd718c7d42 BEWARE this change is only tested on atmel devices so far Andreas Bießmann (1): common/lcd: use lcd_setcolreg() to setup CLUT Bo Shen (1): video: atmel: implement lcd_setcolreg funtion common/lcd.c | 79 +- drivers/video/atmel_hlcdfb.c |6 2 files changed, 22 insertions(+), 63 deletions(-) -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 1/2] video: atmel: implement lcd_setcolreg funtion
From: Bo Shen voice.s...@atmel.com Signed-off-by: Bo Shen voice.s...@atmel.com Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com --- since v2: * add this single patch drivers/video/atmel_hlcdfb.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c index beb7fa3..4110d4d 100644 --- a/drivers/video/atmel_hlcdfb.c +++ b/drivers/video/atmel_hlcdfb.c @@ -51,6 +51,12 @@ short console_row; #define lcdc_readl(reg)__raw_readl((reg)) #define lcdc_writel(reg, val) __raw_writel((val), (reg)) +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) +{ + lcdc_writel((red 16) | (green 8) | blue, + panel_info.mmio + ATMEL_LCDC_LUT(regno)); +} + void lcd_ctrl_init(void *lcdbase) { unsigned long value; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 2/2] common/lcd: use lcd_setcolreg() to setup CLUT
The lcd_setcolreg() is a API provided by the lcd driver and used to setup the color lookup table. However the lcd driver setup the CLUT by using a lot of ifdiffery and accessing the CLUT arrays directly instead. Remove that and use the API. Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com Cc: Marek Vasut ma...@denx.de Cc: Anatolij Gustschin ag...@denx.de --- since v1: * also use lcd_setcolreg() in lcd_display_bitmap() * remove RFC since v2: * no change common/lcd.c | 79 -- 1 file changed, 16 insertions(+), 63 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index b6be800..6835e65 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -523,11 +523,6 @@ static inline ushort *configuration_get_cmap(void) #ifdef CONFIG_LCD_LOGO void bitmap_plot(int x, int y) { -#ifdef CONFIG_ATMEL_LCD - uint *cmap = (uint *)bmp_logo_palette; -#else - ushort *cmap = (ushort *)bmp_logo_palette; -#endif ushort i, j; uchar *bmap; uchar *fb; @@ -545,44 +540,20 @@ void bitmap_plot(int x, int y) fb = (uchar *)(lcd_base + y * lcd_line_length + x); if (NBITS(panel_info.vl_bpix) 12) { - /* Leave room for default color map -* default case: generic system with no cmap (most likely 16bpp) -* cmap was set to the source palette, so no change is done. -* This avoids even more ifdefs in the next stanza -*/ -#if defined(CONFIG_MPC823) - cmap = (ushort *) (cp-lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); -#elif defined(CONFIG_ATMEL_LCD) - cmap = (uint *)configuration_get_cmap(); -#else - cmap = configuration_get_cmap(); -#endif WATCHDOG_RESET(); /* Set color map */ for (i = 0; i ARRAY_SIZE(bmp_logo_palette); ++i) { - ushort colreg = bmp_logo_palette[i]; -#ifdef CONFIG_ATMEL_LCD - uint lut_entry; -#ifdef CONFIG_ATMEL_LCD_BGR555 - lut_entry = ((colreg 0x000F) 11) | - ((colreg 0x00F0) 2) | - ((colreg 0x0F00) 7); -#else /* CONFIG_ATMEL_LCD_RGB565 */ - lut_entry = ((colreg 0x000F) 1) | - ((colreg 0x00F0) 3) | - ((colreg 0x0F00) 4); -#endif - *(cmap + BMP_LOGO_OFFSET) = lut_entry; - cmap++; -#else /* !CONFIG_ATMEL_LCD */ -#ifdef CONFIG_SYS_INVERT_COLORS - *cmap++ = 0x - colreg; -#else - *cmap++ = colreg; -#endif -#endif /* CONFIG_ATMEL_LCD */ + /* use the most significant bits here */ + uint8_t red = ((bmp_logo_palette[i] 4) 0xF0); + uint8_t green = ((bmp_logo_palette[i] 0) 0xF0); + uint8_t blue = ((bmp_logo_palette[i] 4) 0xF0); + debug(LCD: setup colreg %u with + R: 0x%02x G: 0x%02x B: 0x%02x (0x%04x)\n, + i+BMP_LOGO_OFFSET, red, green, blue, bmp_logo_palette[i]); + /* leave room for the default colormap here */ + lcd_setcolreg(i+BMP_LOGO_OFFSET, red, green, blue); } WATCHDOG_RESET(); @@ -667,9 +638,6 @@ static inline void fb_put_word(uchar **fb, uchar **from) int lcd_display_bitmap(ulong bmp_image, int x, int y) { -#if !defined(CONFIG_MCC200) - ushort *cmap = NULL; -#endif ushort *cmap_base = NULL; ushort i, j; uchar *fb; @@ -716,34 +684,18 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) #if !defined(CONFIG_MCC200) /* MCC200 LCD doesn't need CMAP, supports 1bpp bw only */ if (bmp_bpix == 8) { - cmap = configuration_get_cmap(); - cmap_base = cmap; + cmap_base = configuration_get_cmap(); /* Set color map */ for (i = 0; i colors; ++i) { bmp_color_table_entry_t cte = bmp-color_table[i]; -#if !defined(CONFIG_ATMEL_LCD) - ushort colreg = - ( ((cte.red)8) 0xf800) | - ( ((cte.green) 3) 0x07e0) | - ( ((cte.blue) 3) 0x001f) ; -#ifdef CONFIG_SYS_INVERT_COLORS - *cmap = 0x - colreg; -#else - *cmap = colreg; -#endif -#if defined(CONFIG_MPC823) - cmap--; -#else - cmap++; -#endif -#else /* CONFIG_ATMEL_LCD */ + debug(LCD: setup colreg %u with + R: 0x%02x G: 0x%02x B: 0x%02x\n, + i, cte.red, cte.green, cte.blue);
[U-Boot] [PATCH 0/5 v2] Add DT based ethernet driver for SMDK5250
This patch series enables the DT support on SMDK5250. Ethernet is the first driver whose discovery is based on DT node. More DT based drivers to be added subsequently Changes since v1: - Renamed the smdk5250.h file to exynos5250-dt.h to create a common configuration file which can be used by all the boards based on exynos5250 using Device Tree. - Created a new smdk5250.h file specifying the dts file specific to SMDK5250 - Incorporated minor nit (removal of blank lines) Hatim Ali (5): EXYNOS5: FDT: add initial dts file for EXYNOS5250, SMDK5250 fdt: exynos5: Add DT node definition for SROM and SMSC9215 exynos5: Add DT based driver for SMC911X ethernet exynos5: config: Rename the smdk5250.h to exynos5250-dt.h SMDK5250: config: Add configuration file for SMDK5250 board arch/arm/dts/exynos5250.dtsi | 31 arch/arm/include/asm/arch-exynos/sromc.h | 18 ++ board/samsung/dts/exynos5250-smdk5250.dts | 29 +++ board/samsung/smdk5250/smdk5250.c | 115 + include/configs/exynos5250-dt.h | 267 + include/configs/smdk5250.h| 245 +- include/fdtdec.h |2 + lib/fdtdec.c |2 + 8 files changed, 442 insertions(+), 267 deletions(-) create mode 100644 arch/arm/dts/exynos5250.dtsi create mode 100644 board/samsung/dts/exynos5250-smdk5250.dts create mode 100644 include/configs/exynos5250-dt.h -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/5 v2] EXYNOS5: FDT: add initial dts file for EXYNOS5250, SMDK5250
This patch adds initial dts file for EXYNOS5250 SoC. This dts file currently include only ethernet devices and properties. More devices to be added in subsequent patches. Also add the dts file for SMDK5250 board which uses the EXYNOS5250 dts file. Signed-off-by: Hatim Ali hatim...@samsung.com Acked-by: Simon Glass s...@chromium.org --- Changes since v1: - Added Acked-by Simon Glass diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi new file mode 100644 index 000..fa4d498 --- /dev/null +++ b/arch/arm/dts/exynos5250.dtsi @@ -0,0 +1,31 @@ +/* + * SAMSUNG EXYNOS5250 SoC device tree source + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * SAMSUNG EXYNOS5250 SoC device nodes are listed in this file. + * EXYNOS5250 based board files can include this file and provide + * values for board specfic bindings. + * + * Note: This file does not include device nodes for all the controllers in + * EXYNOS5250 SoC. As device tree coverage for EXYNOS5250 increases, + * additional nodes can be added to this file. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +/include/ skeleton.dtsi + +/ { + compatible = samsung,exynos5250; + + sromc@1225 { + compatible = samsung,exynos-sromc; + reg = 0x1225 0x20; + #address-cells = 1; + #size-cells = 0; + }; +}; diff --git a/board/samsung/dts/exynos5250-smdk5250.dts b/board/samsung/dts/exynos5250-smdk5250.dts new file mode 100644 index 000..b6fbb67 --- /dev/null +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -0,0 +1,29 @@ +/* + * SAMSUNG SMDK5250 board device tree source + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +/dts-v1/; +/include/ ARCH_CPU_DTS + +/ { + model = SAMSUNG SMDK5250 board based on EXYNOS5250; + compatible = samsung,smdk5250, samsung,exynos5250; + + sromc@1225 { + bank = 1; + srom-timing = 1 9 12 1 6 1 1; + width = 2; + lan@500 { + compatible = smsc,lan9215, smsc,lan; + reg = 0x500 0x100; + phy-mode = mii; + }; + }; +}; -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/5 v2] fdt: exynos5: Add DT node definition for SROM and SMSC9215
Add the compatibility string and constant for the ethernet driver so the device tree parsing code can recognize it. Signed-off-by: Hatim Ali hatim...@samsung.com Acked-by: Simon Glass s...@chromium.org --- Changes since v1: - Removed extra blank line before COMPAT_SMSC_LAN9215 - Added Acked-by: Simon Glass diff --git a/include/fdtdec.h b/include/fdtdec.h index 0b14075..8f79f8a 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -66,6 +66,8 @@ enum fdt_compat_id { COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */ COMPAT_NVIDIA_TEGRA20_KBC, /* Tegra20 Keyboard */ COMPAT_NVIDIA_TEGRA20_NAND, /* Tegra2 NAND controller */ + COMPAT_SMSC_LAN9215,/* SMSC 10/100 Ethernet LAN9215 */ + COMPAT_SAMSUNG_EXYNOS5_SROMC, /* Exynos5 SROMC */ COMPAT_COUNT, }; diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 4c23f45..d8103fd 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -43,6 +43,8 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(NVIDIA_TEGRA20_EMC_TABLE, nvidia,tegra20-emc-table), COMPAT(NVIDIA_TEGRA20_KBC, nvidia,tegra20-kbc), COMPAT(NVIDIA_TEGRA20_NAND, nvidia,tegra20-nand), + COMPAT(SMSC_LAN9215, smsc,lan9215), + COMPAT(SAMSUNG_EXYNOS5_SROMC, samsung,exynos-sromc), }; const char *fdtdec_get_compatible(enum fdt_compat_id id) -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/5 v2] exynos5: Add DT based driver for SMC911X ethernet
Add device tree based ethernet driver for SMC911X controller on SMDK5250 boards. Signed-off-by: Hatim Ali hatim...@samsung.com Acked-by: Simon Glass s...@chromium.org --- Changes since v1: - Added Acked-by Simon Glass diff --git a/arch/arm/include/asm/arch-exynos/sromc.h b/arch/arm/include/asm/arch-exynos/sromc.h index f616bcb..dc6aae2 100644 --- a/arch/arm/include/asm/arch-exynos/sromc.h +++ b/arch/arm/include/asm/arch-exynos/sromc.h @@ -48,4 +48,22 @@ struct s5p_sromc { /* Configure the Band Width and Bank Control Regs for required SROMC Bank */ void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf); +enum { + FDT_SROM_PMC, + FDT_SROM_TACP, + FDT_SROM_TAH, + FDT_SROM_TCOH, + FDT_SROM_TACC, + FDT_SROM_TCOS, + FDT_SROM_TACS, + + FDT_SROM_TIMING_COUNT, +}; + +struct fdt_sromc { + u8 bank;/* srom bank number */ + u8 width; /* bus width in bytes */ + unsigned int timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */ +}; + #endif /* __ASM_ARCH_SROMC_H_ */ diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c index 4c50342..ac7346d 100644 --- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c @@ -21,6 +21,7 @@ */ #include common.h +#include fdtdec.h #include asm/io.h #include i2c.h #include netdev.h @@ -34,34 +35,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifdef CONFIG_SMC911X -static int smc9115_pre_init(void) -{ - u32 smc_bw_conf, smc_bc_conf; - int err; - - /* Ethernet needs data bus width of 16 bits */ - smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK) - | SROMC_BYTE_ENABLE(CONFIG_ENV_SROM_BANK); - - smc_bc_conf = SROMC_BC_TACS(0x01) | SROMC_BC_TCOS(0x01) - | SROMC_BC_TACC(0x06) | SROMC_BC_TCOH(0x01) - | SROMC_BC_TAH(0x0C) | SROMC_BC_TACP(0x09) - | SROMC_BC_PMC(0x01); - - /* Select and configure the SROMC bank */ - err = exynos_pinmux_config(PERIPH_ID_SROMC, - CONFIG_ENV_SROM_BANK | PINMUX_FLAG_16BIT); - if (err) { - debug(SROMC not configured\n); - return err; - } - - s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf); - return 0; -} -#endif - int board_init(void) { gd-bd-bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); @@ -115,12 +88,94 @@ void dram_init_banksize(void) PHYS_SDRAM_8_SIZE); } +#ifdef CONFIG_OF_CONTROL +static int decode_sromc(const void *blob, struct fdt_sromc *config) +{ + int err; + int node; + + node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC); + if (node 0) { + debug(Could not find SROMC node\n); + return node; + } + + config-bank = fdtdec_get_int(blob, node, bank, 0); + config-width = fdtdec_get_int(blob, node, width, 2); + + err = fdtdec_get_int_array(blob, node, srom-timing, config-timing, + FDT_SROM_TIMING_COUNT); + if (err 0) { + debug(Could not decode SROMC configuration\n); + return -FDT_ERR_NOTFOUND; + } + + return 0; +} +#endif + int board_eth_init(bd_t *bis) { #ifdef CONFIG_SMC911X - if (smc9115_pre_init()) + u32 smc_bw_conf, smc_bc_conf; + struct fdt_sromc config; + fdt_addr_t base_addr; + int node; + +#ifdef CONFIG_OF_CONTROL + node = decode_sromc(gd-fdt_blob, config); + if (node 0) { + debug(%s: Could not find sromc configuration\n, __func__); + return 0; + } + node = fdtdec_next_compatible(gd-fdt_blob, node, COMPAT_SMSC_LAN9215); + if (node 0) { + debug(%s: Could not find lan9215 configuration\n, __func__); + return 0; + } + + /* We now have a node, so any problems from now on are errors */ + base_addr = fdtdec_get_addr(gd-fdt_blob, node, reg); + if (base_addr == FDT_ADDR_T_NONE) { + debug(%s: Could not find lan9215 address\n, __func__); return -1; - return smc911x_initialize(0, CONFIG_SMC911X_BASE); + } +#else + /* Non-FDT configuration - bank number and timing parameters*/ + config.bank = CONFIG_ENV_SROM_BANK; + config.width = 2; + + config.timing[FDT_SROM_TACS] = 0x01; + config.timing[FDT_SROM_TCOS] = 0x01; + config.timing[FDT_SROM_TACC] = 0x06; + config.timing[FDT_SROM_TCOH] = 0x01; + config.timing[FDT_SROM_TAH] = 0x0C; + config.timing[FDT_SROM_TACP] = 0x09; + config.timing[FDT_SROM_PMC] = 0x01; + base_addr = CONFIG_SMC911X_BASE; +#endif + + /* Ethernet needs data bus width of 16 bits */ + if (config.width != 2) { + debug(%s: Unsupported bus width %d\n, __func__, +
[U-Boot] [PATCH 4/5] exynos5: config: Rename the smdk5250.h to exynos5250-dt.h
Create a common configuration file for all exynos5250 based boards. Going forward we will be using DT based driver discovery for all the boards based on Exynos5. The different boards added will have there own config.h files which internally will include this file and specify their specific DT files. Signed-off-by: Hatim Ali hatim...@samsung.com diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h new file mode 100644 index 000..12f555c --- /dev/null +++ b/include/configs/exynos5250-dt.h @@ -0,0 +1,267 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * Configuration settings for the SAMSUNG EXYNOS5250 board. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* High Level Configuration Options */ +#define CONFIG_SAMSUNG /* in a SAMSUNG core */ +#define CONFIG_S5P /* S5P Family */ +#define CONFIG_EXYNOS5 /* which is in a Exynos5 Family */ +#define CONFIG_SMDK5250/* which is in a SMDK5250 */ + +#include asm/arch/cpu.h /* get chip and board defs */ + +#define CONFIG_ARCH_CPU_INIT +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +/* Enable fdt support for Exynos5250 */ +#define CONFIG_ARCH_DEVICE_TREEexynos5250 +#define CONFIG_OF_CONTROL +#define CONFIG_OF_SEPARATE + +/* Keep L2 Cache Disabled */ +#define CONFIG_SYS_DCACHE_OFF + +#define CONFIG_SYS_SDRAM_BASE 0x4000 +#define CONFIG_SYS_TEXT_BASE 0x43E0 + +/* input clock of PLL: SMDK5250 has 24MHz input clock */ +#define CONFIG_SYS_CLK_FREQ2400 + +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_CMDLINE_TAG +#define CONFIG_INITRD_TAG +#define CONFIG_CMDLINE_EDITING + +/* MACH_TYPE_SMDK5250 macro will be removed once added to mach-types */ +#define MACH_TYPE_SMDK5250 3774 +#define CONFIG_MACH_TYPE MACH_TYPE_SMDK5250 + +/* Power Down Modes */ +#define S5P_CHECK_SLEEP0x0BAD +#define S5P_CHECK_DIDLE0xBAD0 +#define S5P_CHECK_LPA 0xABAD + +/* Offset for inform registers */ +#define INFORM0_OFFSET 0x800 +#define INFORM1_OFFSET 0x804 + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 20)) + +/* select serial console configuration */ +#define CONFIG_SERIAL3 /* use SERIAL 3 */ +#define CONFIG_BAUDRATE115200 +#define EXYNOS5_DEFAULT_UART_OFFSET0x01 + +#define TZPC_BASE_OFFSET 0x1 + +/* SD/MMC configuration */ +#define CONFIG_GENERIC_MMC +#define CONFIG_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI + +#define CONFIG_BOARD_EARLY_INIT_F + +/* PWM */ +#define CONFIG_PWM + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE + +/* Command definition*/ +#include config_cmd_default.h + +#define CONFIG_CMD_PING +#define CONFIG_CMD_ELF +#define CONFIG_CMD_MMC +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT +#define CONFIG_CMD_NET + +#define CONFIG_BOOTDELAY 3 +#define CONFIG_ZERO_BOOTDELAY_CHECK + +/* USB */ +#define CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_EXYNOS +#define CONFIG_USB_STORAGE + +/* MMC SPL */ +#define CONFIG_SPL +#define COPY_BL2_FNPTR_ADDR0x02020030 + +/* specific .lds file */ +#define CONFIG_SPL_LDSCRIPTboard/samsung/smdk5250/smdk5250-uboot-spl.lds +#define CONFIG_SPL_TEXT_BASE 0x02023400 +#define CONFIG_SPL_MAX_SIZE(14 * 1024) + +#define CONFIG_BOOTCOMMAND mmc read 40007000 451 2000; bootm 40007000 + +/* Miscellaneous configurable options */ +#define CONFIG_SYS_LONGHELP/* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/ +#define CONFIG_SYS_PROMPT SMDK5250 # +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_PBSIZE 384 /* Print Buffer Size */ +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +#define CONFIG_DEFAULT_CONSOLE console=ttySAC1,115200n8\0 +/* Boot Argument
[U-Boot] [PATCH 5/5] SMDK5250: config: Add configuration file for SMDK5250 board
Add the configuration file for exynos5250 based SMDK5250 board. Signed-off-by: Hatim Ali hatim...@samsung.com diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h new file mode 100644 index 000..81f83a8 --- /dev/null +++ b/include/configs/smdk5250.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * Configuration settings for the SAMSUNG SMDK5250 board. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_SMDK_H +#define __CONFIG_SMDK_H + +#include configs/exynos5250-dt.h + +#undef CONFIG_DEFAULT_DEVICE_TREE +#define CONFIG_DEFAULT_DEVICE_TREE exynos5250-smdk5250 + +#endif /* __CONFIG_SMDK_H */ -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/8] Add TMU support for Exynos5250 based SMDK5250
The patch series add support for TMU driver using device tree for Exynos5250 based SMDK5250 board. This patch series is dependent on the patch series Add DT based ethernet driver for SMDK5250 by Hatim Ali Akshay Saraswat (5): EXYNOS5: FDT: Add TMU device node values EXYNOS5: TMU: Add driver for Thermal Management Unit EXYNOS5: Power down API for Thermal Management Unit GEN: Add a poll function to monitor events EXYNOS5: TMU: Add TMU status polling Alim Akhtar (1): GEN: TMU: Add u-boot command to read current temp Hatim Ali (2): EXYNOS5: Config: Enable support for Exynos TMU driver EXYNOS5: Config: Enable tmu command README|7 + arch/arm/cpu/armv7/exynos/power.c | 11 + arch/arm/dts/exynos5250.dtsi |5 + arch/arm/include/asm/arch-exynos/exynos-tmu.h | 82 +++ arch/arm/include/asm/arch-exynos/power.h |4 + board/samsung/dts/exynos5250-smdk5250.dts | 13 + board/samsung/smdk5250/smdk5250.c | 36 +++ common/Makefile |1 + common/cmd_tmu.c | 51 + common/console.c |5 + doc/device-tree-bindings/exynos/tmu.txt | 35 +++ drivers/power/Makefile|1 + drivers/power/exynos-tmu.c| 296 + include/common.h |8 + include/configs/exynos5250-dt.h |7 + include/fdtdec.h |1 + lib/fdtdec.c |1 + 17 files changed, 564 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/exynos-tmu.h create mode 100644 common/cmd_tmu.c create mode 100644 doc/device-tree-bindings/exynos/tmu.txt create mode 100644 drivers/power/exynos-tmu.c -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/8] EXYNOS5: FDT: Add TMU device node values
From: Akshay Saraswat aksha...@samsung.com Fdt entry for Exynos TMU driver specific pre-defined values used for calibration of current temperature and defining threshold values. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi index fa4d498..db22db6 100644 --- a/arch/arm/dts/exynos5250.dtsi +++ b/arch/arm/dts/exynos5250.dtsi @@ -28,4 +28,9 @@ #address-cells = 1; #size-cells = 0; }; + + tmu@1006 { + compatible = samsung,exynos-tmu; + reg = 0x1006 0x; + }; }; diff --git a/board/samsung/dts/exynos5250-smdk5250.dts b/board/samsung/dts/exynos5250-smdk5250.dts index b6fbb67..2d3ecca 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -26,4 +26,17 @@ phy-mode = mii; }; }; + + tmu@1006 { + samsung,mux = 6; + samsung,min-temp= 25; + samsung,max-temp= 125; + samsung,start-warning = 95; + samsung,start-tripping = 105; + samsung,efuse-min-value = 40; + samsung,efuse-value = 55; + samsung,efuse-max-value = 100; + samsung,slope = 268470274; + samsung,dc-value= 25; + }; }; diff --git a/doc/device-tree-bindings/exynos/tmu.txt b/doc/device-tree-bindings/exynos/tmu.txt new file mode 100644 index 000..99e7164 --- /dev/null +++ b/doc/device-tree-bindings/exynos/tmu.txt @@ -0,0 +1,35 @@ +Exynos Thermal management Unit + +The device node for TMU that is a part of Exynos5250 +SOC is as described in the document Open Firmware Recommended +Practic : Universal Serial Bus with the following modifications +and additions: + +Required properties : + - compatible : Should be samsung,exynos-tmu for TMU + - samsung,mux : mux Address for the TMU to enable TMU core: + - samsung,min-temp : Minimum temperature, default is 25: + - samsung,max-temp : Maximum temperature, defalut set to 125: + - samsung,start-warning : temp at which TMU start giving warning: + - samsung,start-tripping : temp at which system will trip and shutdown: + - samsung,efuse-min-value : SOC efuse min value: + - samsung,efuse-value : SOC actual efuse value: + - samsung,efuse-max-value : SoC max efuse value: + - samsung,slope : Gain of amplifier, default is 268470274: + - samsung,dc-value : DC value of TMU, default is 25: + +Example: + +tmu@1006 { + compatible = samsung,exynos-tmu + samsung,mux = 6; + samsung,min-temp = 25; + samsung,max-temp = 125; + samsung,start-warning = 95; + samsung,start-tripping = 105; + samsung,efuse-min-value = 40; + samsung,efuse-value = 55; + samsung,efuse-max-value = 100; + samsung,slope = 268470274; + samsung,dc-value = 25; +}; diff --git a/include/fdtdec.h b/include/fdtdec.h index 8f79f8a..180dfff 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -68,6 +68,7 @@ enum fdt_compat_id { COMPAT_NVIDIA_TEGRA20_NAND, /* Tegra2 NAND controller */ COMPAT_SMSC_LAN9215,/* SMSC 10/100 Ethernet LAN9215 */ COMPAT_SAMSUNG_EXYNOS5_SROMC, /* Exynos5 SROMC */ + COMPAT_SAMSUNG_EXYNOS_TMU, /* Exynos TMU */ COMPAT_COUNT, }; diff --git a/lib/fdtdec.c b/lib/fdtdec.c index d8103fd..8e5ed21 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -45,6 +45,7 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(NVIDIA_TEGRA20_NAND, nvidia,tegra20-nand), COMPAT(SMSC_LAN9215, smsc,lan9215), COMPAT(SAMSUNG_EXYNOS5_SROMC, samsung,exynos-sromc), + COMPAT(SAMSUNG_EXYNOS_TMU, samsung,exynos-tmu), }; const char *fdtdec_get_compatible(enum fdt_compat_id id) -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/8] EXYNOS5: TMU: Add driver for Thermal Management Unit
From: Akshay Saraswat aksha...@samsung.com Adding Exynos Thermal Management Unit driver to monitor SOC temperature and take actions corresponding to states of TMU. System will shutdown if tripping temperature is reached. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/arch/arm/include/asm/arch-exynos/exynos-tmu.h b/arch/arm/include/asm/arch-exynos/exynos-tmu.h new file mode 100644 index 000..ad9e394 --- /dev/null +++ b/arch/arm/include/asm/arch-exynos/exynos-tmu.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * Akshay Saraswat aksha...@samsung.com + * + * EXYNOS - Thermal Management Unit + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __ASM_ARCH_THERMAL_H +#define __ASM_ARCH_THERMAL_H + +struct tmu_reg { + unsigned triminfo; + unsigned rsvd1; + unsigned rsvd2; + unsigned rsvd3; + unsigned rsvd4; + unsigned triminfo_control; + unsigned rsvd5; + unsigned rsvd6; + unsigned tmu_control; + unsigned rsvd7; + unsigned tmu_status; + unsigned sampling_internal; + unsigned counter_value0; + unsigned counter_value1; + unsigned rsvd8; + unsigned rsvd9; + unsigned current_temp; + unsigned rsvd10; + unsigned rsvd11; + unsigned rsvd12; + unsigned threshold_temp_rise; + unsigned threshold_temp_fall; + unsigned rsvd13; + unsigned rsvd14; + unsigned past_temp3_0; + unsigned past_temp7_4; + unsigned past_temp11_8; + unsigned past_temp15_12; + unsigned inten; + unsigned intstat; + unsigned intclear; + unsigned rsvd15; + unsigned emul_con; +}; + +enum tmu_status_t { + TMU_STATUS_INIT = 0, + TMU_STATUS_NORMAL, + TMU_STATUS_WARNING, + TMU_STATUS_TRIPPED, +}; + +/* + * Monitors status of the TMU device and exynos temperature + * + * @param temp pointer to the current temperature value + * @return enum tmu_status_t value, code indicating event to execute + * and -1 on error + */ +enum tmu_status_t tmu_monitor(int *temp); + +/* + * Initialize TMU device + * + * @param blob FDT blob + * @return int value, 0 for success + */ +int tmu_init(const void *blob); +#endif diff --git a/drivers/power/Makefile b/drivers/power/Makefile index 6bf388c..192a7cb 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -30,6 +30,7 @@ COBJS-$(CONFIG_TPS6586X_POWER)+= tps6586x.o COBJS-$(CONFIG_TWL4030_POWER) += twl4030.o COBJS-$(CONFIG_TWL6030_POWER) += twl6030.o COBJS-$(CONFIG_TWL6035_POWER) += twl6035.o +COBJS-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/power/exynos-tmu.c b/drivers/power/exynos-tmu.c new file mode 100644 index 000..ee596d5 --- /dev/null +++ b/drivers/power/exynos-tmu.c @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * Akshay Saraswat aksha...@samsung.com + * + * EXYNOS - Thermal Management Unit + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include errno.h +#include fdtdec.h +#include asm/arch/exynos-tmu.h + +#define TRIMINFO_RELOAD1 +#define CORE_EN1 + +#define INTEN_RISE01 +#define INTEN_RISE1(1 4) +#define INTEN_RISE2(1 8) +#define INTEN_FALL0(1 16) +#define INTEN_FALL1(1 20) +#define INTEN_FALL2(1 24) + +#define TRIM_INFO_MASK 0xff + +#define INTCLEAR_RISE0 1 +#define INTCLEAR_RISE1 (1 4) +#define INTCLEAR_RISE2 (1 8) +#define INTCLEAR_FALL0 (1 16) +#define INTCLEAR_FALL1 (1 20) +#define INTCLEAR_FALL2 (1 24) +#define INTCLEARALL(INTCLEAR_RISE0 | INTCLEAR_RISE1 | \ +INTCLEAR_RISE2 | INTCLEAR_FALL0 | \ +INTCLEAR_FALL1 | INTCLEAR_FALL2) + +/* Tmeperature threshold values for various thermal
[U-Boot] [PATCH 3/8] EXYNOS5: Power down API for Thermal Management Unit
From: Akshay Saraswat aksha...@samsung.com Adding API in power for system shutdown when tripping value is reached in Exynos Thermal Management Unit. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c index d4bce6d..a6d8827 100644 --- a/arch/arm/cpu/armv7/exynos/power.c +++ b/arch/arm/cpu/armv7/exynos/power.c @@ -95,3 +95,14 @@ void set_dp_phy_ctrl(unsigned int enable) if (cpu_is_exynos5()) exynos5_dp_phy_control(enable); } + +/* This function never returns */ +void power_shutdown(void) +{ + struct exynos5_power *power = + (struct exynos5_power *)samsung_get_base_power(); + + clrbits_le32(power-ps_hold_control, POWER_PS_HOLD_CONTROL_DATA_HIGH); + + hang(); +} diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h index d2fdb59..7d798ba 100644 --- a/arch/arm/include/asm/arch-exynos/power.h +++ b/arch/arm/include/asm/arch-exynos/power.h @@ -863,5 +863,9 @@ void set_usbhost_phy_ctrl(unsigned int enable); void set_dp_phy_ctrl(unsigned int enable); #define EXYNOS_DP_PHY_ENABLE (1 0) +#define POWER_PS_HOLD_CONTROL_DATA_HIGH (1 8) + +/* This function never returns */ +void power_shutdown(void); #endif -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/8] GEN: Add a poll function to monitor events
From: Akshay Saraswat aksha...@samsung.com Add a generic polling function to continuously monitor events and trigger actions corresponding to them. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/README b/README index 2572add..72b3b67 100644 --- a/README +++ b/README @@ -2814,6 +2814,13 @@ Configuration Settings: the application (usually a Linux kernel) when it is booted +- CONFIG_BOARD_POLL + There are various scenarios in which parallel-thread like + polling is required to monitor status of variety of devices. + For such situations CONFIG_BOARD_POLL shall be enabled + and funtion call board_poll_devices() from console_tstc() + will then poll for the device status as defined inside function. + - CONFIG_SYS_BAUDRATE_TABLE: List of legal baudrate settings for this board. diff --git a/common/console.c b/common/console.c index 1177f7d..d320b9b 100644 --- a/common/console.c +++ b/common/console.c @@ -117,6 +117,11 @@ static int console_tstc(int file) int i, ret; struct stdio_dev *dev; +#if defined CONFIG_BOARD_POLL + /* Generic polling function */ + board_poll_devices(); +#endif + disable_ctrlc(1); for (i = 0; i cd_count[file]; i++) { dev = console_devices[file][i]; diff --git a/include/common.h b/include/common.h index b23e90b..cba2e3b 100644 --- a/include/common.h +++ b/include/common.h @@ -782,6 +782,14 @@ void clear_ctrlc (void); /* clear the Control-C condition */ intdisable_ctrlc (int);/* 1 to disable, 0 to enable Control-C detect */ /* + * A generic polling function + * This will be called to poll for some events, + * In this case this will be called form console_tstc() to monitor + * temperatur of the SOC + */ +void board_poll_devices(void); + +/* * STDIO based functions (can always be used) */ /* serial stuff */ -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/8] EXYNOS5: TMU: Add TMU status polling
From: Akshay Saraswat aksha...@samsung.com This adds call to tmu_init() and TMU status polling in board_poll_devices() funtion to monitor temperature change of the SOC. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c index ac7346d..19eb2e0 100644 --- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c @@ -32,15 +32,51 @@ #include asm/arch/pinmux.h #include asm/arch/sromc.h #include pmic.h +#include asm/arch/exynos-tmu.h +#include asm/arch/power.h DECLARE_GLOBAL_DATA_PTR; +/* + * Polling various devices on board for details and status monitoring purposes + */ +void board_poll_devices(void) +{ +#if defined CONFIG_EXYNOS_TMU + int temp; + + switch (tmu_monitor(temp)) { + case TMU_STATUS_TRIPPED: + puts(EXYNOS_TMU: TRIPPING! Device power going down ...\n); + power_shutdown(); + break; + case TMU_STATUS_WARNING: + puts(EXYNOS_TMU: WARNING! Temperature very high\n); + break; + case TMU_STATUS_INIT: + case TMU_STATUS_NORMAL: + debug(syetm is in normal temperature state\n); + break; + default: + debug(Unknown TMU state\n); + } +#endif +} + int board_init(void) { gd-bd-bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); #if defined(CONFIG_PMIC) pmic_init(); #endif + +#if defined CONFIG_EXYNOS_TMU + if (tmu_init(gd-fdt_blob)) { + debug(%s: Failed to init TMU\n, __func__); + return -1; + } +#endif + #ifdef CONFIG_EXYNOS_SPI spi_init(); #endif -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 6/8] EXYNOS5: Config: Enable support for Exynos TMU driver
Enables TMU driver support for exynos5250 Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index 12f555c..2f4315a 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -106,6 +106,12 @@ #define CONFIG_BOOTDELAY 3 #define CONFIG_ZERO_BOOTDELAY_CHECK +/* Generic Device Polling */ +#define CONFIG_BOARD_POLL + +/* Thermal Management Unit */ +#define CONFIG_EXYNOS_TMU + /* USB */ #define CONFIG_CMD_USB #define CONFIG_USB_EHCI -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 7/8] GEN: TMU: Add u-boot command to read current temp
From: Alim Akhtar alim.akh...@samsung.com Adds a new u-boot command to read current temprature from tmu driver. Signed-off-by: Alim Akhtar alim.akh...@samsung.com diff --git a/common/Makefile b/common/Makefile index dca2f53..b56ffa2 100644 --- a/common/Makefile +++ b/common/Makefile @@ -159,6 +159,7 @@ COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o COBJS-$(CONFIG_CMD_TIME) += cmd_time.o COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o +COBJS-$(CONFIG_CMD_TMU) += cmd_tmu.o COBJS-$(CONFIG_CMD_TPM) += cmd_tpm.o COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o diff --git a/common/cmd_tmu.c b/common/cmd_tmu.c new file mode 100644 index 000..db0a714 --- /dev/null +++ b/common/cmd_tmu.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * Alim Akhtar alim.akh...@samsung.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include command.h +#include asm/arch/exynos-tmu.h + +int do_tmu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int cur_temp; + + if (argc 2) + return CMD_RET_USAGE; + + if (strcmp(argv[1], curtemp) == 0) { + if (tmu_monitor(cur_temp) == -1) + printf(tmu is in unknow state, temp is invalid\n); + else + printf(Current Temp: %u degrees Celsius\n, cur_temp); + } else { + return CMD_RET_USAGE; + } + + return 0; +} + +U_BOOT_CMD( + tmu, 2, 1, do_tmu, + Thermal Management Unit\n, + curtemp - show current cpu temperature in degrees celsius\n +); -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 8/8] EXYNOS5: Config: Enable tmu command
This enables the tmu command to read the current SOC temperature with the help of TMU Signed-off-by: Alim Akhtar alim.akh...@samsung.com diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index 2f4315a..2b9271c 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -111,6 +111,7 @@ /* Thermal Management Unit */ #define CONFIG_EXYNOS_TMU +#define CONFIG_CMD_TMU /* USB */ #define CONFIG_CMD_USB -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] SMSC LAN9514 on TI DM37x board
On Tue, Nov 6, 2012 at 9:24 AM, Felix Radensky fe...@embedded-sol.comwrote: Hi Marek, On 11/06/2012 12:57 AM, Marek Vasut wrote: Can you please avoid top-posting? Does U-Boot even support your USB device? Sorry about top-posting. My USB device is supported by smsc95xx.c driver in drivers/usb/eth. Judging by the portion of config you cited you don't have it enabled. But I don't think that's your current problem (you should see your device after usb start even if there is no driver for it). I'd verify PHY configuration if I were you. Regards, Ilya. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5
On Tue 2012-11-06 01:56:50, Marek Vasut wrote: Dear Pavel Machek, Hi! In message 20121105200340.GA15821@xo-6d-61-c0.localdomain you wrote: /* Append length in bits and transform */ - ctx-in32[14] = ctx-bits[0]; - ctx-in32[15] = ctx-bits[1]; + memcpy(ctx-in + 14 * sizeof(__u32), ctx-bits, 2 * sizeof(__u32)); Is there some alternate solution? The memcpy is really ugly... Plus... does it solve the issue? The code does not look like being compatible with strict pointer aliasing... and I don't think memcpy() helps. arch/nds32/config.mk:PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax arch/x86/config.mk:PLATFORM_CPPFLAGS += -fno-strict-aliasing We should really do that globally. Were you even able to replicate this problem in the first place? Isn't this whole problem a problem of a broken (ubuntu/linaro) toolchain again? This is not something you can replicate. At least md5 code is unsafe with strict aliasing, probably most of u-boot, because low-level people write code like that. Thus we should do -fno-strict-aliasing. Otherwise compiler may decide in future to miscompile our code, even if it compiles it correctly now. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] USB mass storage gadget patch
Lukasz, Lukasz, Hi victor, Regarding UMS support: The last version posted at u-boot ML can be found at [**]: http://thread.gmane.org/gmane.comp.boot-loaders.u- boot/113004/match=ums +if (fsg_fs_bulk_out_desc.bEndpointAddress != 0x1) + fsg_fs_bulk_out_desc.bEndpointAddress = 0x1; + If possible, please align to patch set [**], so we can have the same setup. However, I will try to find some time to help you with the problem (that's why I've asked for description of the problem, which you are trying to fix). I hardcode bulk out endpoint to EP1 because the hardware only got one endpoint. So the code has to use EP1 for both bulk in and bulk out data transfer. Will this break the usb mass storage gadget code? I will get the file_storage.c from [**]. The short description of the problem: The U-boot usb mass storage gadget driver has problem with buffer management, sometimes the buffer returned by IRQ routine and the get_next_command function are different. It causes problem in processing SCSI_MODE_SELECT_6 command. The detailed description of the problem: When receiving the SCSI_MODE_SELECT_6 command, in bulk_out_complete(), the bh pointer is 0x1b872e4. Then, in get_next_command(), before calling start_transfer(), the bh pointer becomes 0x1b87304. This changes in bh pointer can cause data not to be processed by the usb mass storage gadget code. Thanks, Victor I use the file_storage.c from [**]. Basically, I replace file_storage.c and hardcode bulk out endpoint to EP1. The IRQ routine can receive the SCSI_INQUIRY but the get_next_command() do not process it. The get_next_command is listening on a different bh than the one returned by IRQ routine. Regards, victor CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and may be protected by legal privilege. If you are not the intended addressee (or authorized to receive for the addressee). be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you for your cooperation. KeyASIC Inc. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
On 11/05/2012 04:47 PM, Simon Glass wrote: Hi Stephen, On Mon, Nov 5, 2012 at 3:04 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Signed-off-by: Stephen Warren swar...@nvidia.com Acked-by: Simon Glass s...@chromium.org This seems like a problem that might come up in other areas. I wonder if SPL should have its own autoconf.mk? That might be a good idea. Is the config.h separate for SPL-vs-non-SPL? Perhaps it doesn't need to be because it's simply always evaluated at each individual compile time, whereas perhaps autoconf.mk is generated once rather than evaluated? As you can tell, I have not looked into this or most aspects of U-Boot's build system, so I have no idea how feasible fixing the build system for this would be. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
On 11/05/2012 05:54 PM, Marek Vasut wrote: Dear Stephen Warren, From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Uh, don't you want the bounce buffer not compiled in for SPL? Then maybe add CONFIG_SPL_BOUNCE_BUFFER to force BB to be compiled into SPL or something ... Not compiling bouncebuf.c for SPL would solve this too. I have no idea what build system contortions would be required to do this though. Do you think the build system should be fixed first rather than taking this series/patch? I guess we shouldn't need a separate CONFIG_SPL_BOUNCE_BUFFER option though; we should rather simply set CONFIG_SPL_BOUNCE_BUFFER appropriately for SPL and non-SPL, and have everything key off that one variable, right? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] common: rework bouncebuf implementation
On 11/05/2012 04:54 PM, Simon Glass wrote: Hi Stephen, On Mon, Nov 5, 2012 at 3:04 PM, Stephen Warren swar...@wwwdotorg.org wrote: The current bouncebuf API requires all parameters to be passed to both bounce_buffer_start() and bounce_buffer_stop(). This works fine when both functions are called from the same place. However, Tegra's MMC driver splits the data setup and post-processing steps between two functions, and passing all that state around separately would be painful. Modify the bouncebuf API to accept a state structure as a parameter, so that only a single struct needs to be passed to both APIs. ... I wonder if the dcache handling could be done here (and in the memcpy() below), perhaps under the control of a new flag. After the cache code in both drivers seems very similar. Yes, that's a good idea. It cross my mind before, but I forgot to follow up on it and realize that the cache management APIs are actually common, not CPU-specific. One question here. The MXS MMC driver contains: if (data-flags MMC_DATA_WRITE) { /* Flush data to DRAM so DMA can pick them up */ flush_dcache_range((uint32_t)bbstate.bounce_buffer, (uint32_t)(bbstate.bounce_buffer) + bbstate.len_aligned); } /* Invalidate the area, so no writeback into the RAM races with DMA */ invalidate_dcache_range((uint32_t)priv-desc-cmd.address, (uint32_t)(priv-desc-cmd.address + bbstate.len_aligned)); It the invalidate_dcache_range() really necessary here? I would assume that the flush_dcache_range() call marks the cache non-dirty, so there can no longer be any write-backs to race with the DMA. Certainly, the Tegra MMC driver doesn't include that invalidate call and appears to work fine. I agree with all your comments that I haven't quoted here, and will go implement them. -static inline int bounce_buffer_start(void **data, size_t len, void **backup, - uint8_t flags) +struct bounce_buffer_state { + void *bounce_buffer; + size_t len_aligned; +}; + +static inline int bounce_buffer_start(struct bounce_buffer_state *state, + void *data, size_t len, uint8_t flags) { + state-bounce_buffer = data; + state-len_aligned = len; Why do you need to do this if it is just a null implementation? Perhaps add a comment. I wondered whether we should simply remove the dummy implementations completely; it seems that if any MMC driver needs bouncebuf ever, it always needs it. Hence, there should never be a case where these APIs are called/referenced, yet CONFIG_BOUNCE_BUFFER is not set. However, there is such a case right now; sc_sps_1.h enables the MXS MMC driver but not the bounce buffer. Perhaps I should just send a patch to fix that, and remove these dummy functions. Aside from that, the reason these dummy functions need to set fields in *state right now is that the MXS MMC driver unconditionally accesses those fields, so they need to exist and contain valid data. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] mmc: tegra: use bounce buffer APIs
On 11/05/2012 05:00 PM, Simon Glass wrote: Hi Stephen, On Mon, Nov 5, 2012 at 3:04 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com Tegra's MMC driver does DMA, and hence needs cache-aligned buffers. In some cases (e.g. user load commands) this cannot be guaranteed by callers of the MMC APIs. To solve this, modify the Tegra MMC driver to use the new bounce_buffer_*() APIs. diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c #include asm/arch-tegra/clk_rst.h #include asm/arch-tegra/tegra_mmc.h #include mmc.h +#include bouncebuf.h The order seems wrong here - I think bouncebuf and mmc should go above the asm/ ones, and bouncebuf should be first. Is there a defined order for header files? I suppose I should try and read and remember more documentation! @@ -180,8 +196,10 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, if (data) mmc_set_transfer_mode(host, data); - if ((cmd-resp_type MMC_RSP_136) (cmd-resp_type MMC_RSP_BUSY)) - return -1; + if ((cmd-resp_type MMC_RSP_136) (cmd-resp_type MMC_RSP_BUSY)) { + ret = -1; + goto cleanup; + } You might consider putting this body in a function so you don't need these two lines everywhere below. I'm not quite sure how a function would work here; a function can't really goto. Do you mean a macro? I'd tend to this a macro would obfuscate the pretty simple code. Oh, perhaps you mean having a new top-level function that does: bounce_buffer_start(); calls a function to do all the work bounce_buffer_stop(); That would certainly simplify the patch. diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h +#ifdef CONFIG_TEGRA_MMC +#define CONFIG_BOUNCE_BUFFER +#endif Is there really any harm in just defining this always (say in the tegra20-common.h)? The functions should be dropped if not used. I suppose it'd be fine to always enable this since the linker should drop the functions when not referenced. Of course, that relies on bouncebuf.o not having any global side-effects (e.g. registering things via custom linker segments that are always pulled in). The code above represents the actual dependency too; hopefully one day U-Boot will sprout Kconfig, and that logic can be replaced by: config TEGRA_MMC select BOUNCE_BUFFER ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3] mmc: tegra: use bounce buffer APIs
Hi Stephen, On Tue, Nov 6, 2012 at 10:50 AM, Stephen Warren swar...@wwwdotorg.org wrote: On 11/05/2012 05:00 PM, Simon Glass wrote: Hi Stephen, On Mon, Nov 5, 2012 at 3:04 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com Tegra's MMC driver does DMA, and hence needs cache-aligned buffers. In some cases (e.g. user load commands) this cannot be guaranteed by callers of the MMC APIs. To solve this, modify the Tegra MMC driver to use the new bounce_buffer_*() APIs. diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c #include asm/arch-tegra/clk_rst.h #include asm/arch-tegra/tegra_mmc.h #include mmc.h +#include bouncebuf.h The order seems wrong here - I think bouncebuf and mmc should go above the asm/ ones, and bouncebuf should be first. Is there a defined order for header files? I suppose I should try and read and remember more documentation! According to Mike, the order should generally be: - stuff in include/ - stuff in sys/ - stuff in linux/ - stuff in asm/ each sub-region can be sorted, but i don't think we should go against the subdir rule @@ -180,8 +196,10 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, if (data) mmc_set_transfer_mode(host, data); - if ((cmd-resp_type MMC_RSP_136) (cmd-resp_type MMC_RSP_BUSY)) - return -1; + if ((cmd-resp_type MMC_RSP_136) (cmd-resp_type MMC_RSP_BUSY)) { + ret = -1; + goto cleanup; + } You might consider putting this body in a function so you don't need these two lines everywhere below. I'm not quite sure how a function would work here; a function can't really goto. Do you mean a macro? I'd tend to this a macro would obfuscate the pretty simple code. Oh, perhaps you mean having a new top-level function that does: bounce_buffer_start(); calls a function to do all the work bounce_buffer_stop(); That would certainly simplify the patch. Yes that's what I meant. diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h +#ifdef CONFIG_TEGRA_MMC +#define CONFIG_BOUNCE_BUFFER +#endif Is there really any harm in just defining this always (say in the tegra20-common.h)? The functions should be dropped if not used. I suppose it'd be fine to always enable this since the linker should drop the functions when not referenced. Of course, that relies on bouncebuf.o not having any global side-effects (e.g. registering things via custom linker segments that are always pulled in). The code above represents the actual dependency too; hopefully one day U-Boot will sprout Kconfig, and that logic can be replaced by: config TEGRA_MMC select BOUNCE_BUFFER Yes, maybe it isn't that simple in general, but it seems that it might be safe with Tegra at least. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] common: rework bouncebuf implementation
On 11/05/2012 04:54 PM, Simon Glass wrote: Hi Stephen, On Mon, Nov 5, 2012 at 3:04 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com The current bouncebuf API requires all parameters to be passed to both bounce_buffer_start() and bounce_buffer_stop(). This works fine when both functions are called from the same place. However, Tegra's MMC driver splits the data setup and post-processing steps between two functions, and passing all that state around separately would be painful. Modify the bouncebuf API to accept a state structure as a parameter, so that only a single struct needs to be passed to both APIs. diff --git a/common/bouncebuf.c b/common/bouncebuf.c -int bounce_buffer_start(void **data, size_t len, void **backup, uint8_t flags) +int bounce_buffer_start(struct bounce_buffer_state *state, void *data, + size_t len, uint8_t flags) { - void *tmp; - size_t alen; + state-user_buffer = data; + state-bounce_buffer = data; + state-len = len; + state-len_aligned = roundup(len, ARCH_DMA_MINALIGN); + state-flags = flags; - if (addr_aligned(*data, len)) { - *backup = NULL; + if (addr_aligned(data, len)) Maybe consider checking for data == NULL here, and return 0. This would allow you to remove your 'if (data)' checks in the tegra driver. Would need to update function description in the header file though. That doesn't actually work out. The if (data) test in the Tegra driver is checking whether a non-NULL struct mmc_data *data is passed to Tegra's mmc_send_cmd(). That value isn't directly passed to bounce_buffer_start(), but rather data-{src,dest}, which doesn't even exist if (!data). ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] usb: ehci: Take advantage of the new multi-controller feature for MXC
Dear Lucas Stach, On Tuesday, November 6, 2012 8:43:43 AM, Lucas Stach wrote: Am Dienstag, den 06.11.2012, 00:56 +0100 schrieb Marek Vasut: Dear Benoît Thébaudeau, Dear Marek Vasut, On Monday, November 5, 2012 11:54:12 PM, Marek Vasut wrote: Dear Benoît Thébaudeau, Hi Marek, Thanks to Lucas' series coming with commits c7e3b2b and 676ae06, I'd like to use the multi-controller feature on MXC since most of these SoCs come with a USB IP supporting an OTG controller and multiple host-only controllers. Currently the MXC code in ehci-mx{c|5|6}.c just ignores the index passed to ehci_hcd_init() and the like, and there are 3 port-specific configs (CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS and CONFIG_MXC_USB_PORTSC). Not all USB ports from the USB IP will be available on each board for a given SoC, so we need a logical to physical USB port mapping. I would suggest something like the following. board.h: #define CONFIG_MXC_USB{ \ { \ 0, \ MXC_EHCI_INTERNAL_PHY, \ MXC_EHCI_UTMI_16BIT | MXC_EHCI_MODE_UTMI \ }, { \ 1, \ MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_PWR_PIN_ACTIVE_HIGH | \ MXC_EHCI_OC_PIN_ACTIVE_LOW, \ MXC_EHCI_MODE_ULPI \ }, \ } ehci-fsl.h: struct mxc_ehci_cfg { int port; u32 flags; u32 portsc; }; ehci-mx{c|5|6}.c: static const struct mxc_ehci_cfg cfg[CONFIG_USB_MAX_CONTROLLER_COUNT] = CONFIG_MXC_USB; Then, in ehci_hcd_init(), there would be the following replacements: - CONFIG_MXC_USB_PORT - cfg[index].port, - CONFIG_MXC_USB_FLAGS - cfg[index].flags, - CONFIG_MXC_USB_PORTSC - cfg[index].portsc. What do you think? What about passing port private / platform data instead of ID ? The ID is already passed to ehci_hcd_init(), so we have to live with it if we don't want to change the newly introduced multi-controller infrastructure. Let's change it remove the ID and pass some generic pdata. I don't like the idea of passing around data at this level. It's breaking the abstraction, as we have to pass low-level usb information around in the higher USB stack levels. The USB driver code should be able to do the virt-to-phys controller mapping on it's own. In the Tegra world we use the information we get from device tree to do so, but I don't see a reason why your USB host driver code wouldn't be able to just require an array with configuration data from the board file. There is really no need to pass this information through all the USB stack interfaces. I agree, all the more ehci_hcd_init() is called from cmd_usb.c, completely outside of any board init context, so collecting the platform data would be a real pain, without bringing much. And moving usb_init() calls to board init context would also not be good because of the added boot time. IMHO, the best solutions here are either a CONFIG_MXC_USB as I suggested, or the same structure passed to some init function specific to these EHCI drivers (which would add more code for little benefit). Marek? Stefano? Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] USB: add arrow key support to usb_kbd
Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue, but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin amar...@nvidia.com --- common/usb_kbd.c | 13 + 1 file changed, 13 insertions(+) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 24467ce..4efbcfe 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -94,6 +94,15 @@ static const unsigned char usb_kbd_num_keypad[] = { }; /* + * map arrow keys to ^F/^B ^N/^P, can't really use the proper + * ANSI sequence for arrow keys because the queuing code breaks + * when a single keypress expands to 3 queue elements + */ +static const unsigned char usb_kbd_arrow[] = { + 0x6, 0x2, 0xe, 0x10 +}; + +/* * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this * order. See usb_kbd_setled() function! */ @@ -224,6 +233,10 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode, keycode = usb_kbd_numkey[scancode - 0x1e]; } + /* Arrow keys */ + if ((scancode = 0x4f) (scancode = 0x52)) + keycode = usb_kbd_arrow[scancode - 0x4f]; + /* Numeric keypad */ if ((scancode = 0x54) (scancode = 0x67)) keycode = usb_kbd_num_keypad[scancode - 0x54]; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V2 1/4] Replace CONFIG_MMC_BOUNCE_BUFFER with CONFIG_BOUNCE_BUFFER in configs
From: Stephen Warren swar...@nvidia.com Commits 6dc71c8 MMC: MXS: Toggle the generic bounce buffer on the boards and 49a627f MMC: Remove the MMC bounce buffer replaced CONFIG_MMC_BOUNCE_BUFFER with CONFIG_BOUNCE_BUFFER, but missed converting a few boards over to the new option. Fix this. Signed-off-by: Stephen Warren swar...@nvidia.com --- v2: New patch. --- include/configs/mx6qarm2.h |2 +- include/configs/mx6qsabre_common.h |2 +- include/configs/mx6qsabrelite.h|2 +- include/configs/sc_sps_1.h |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h index 23562a8..28a3deb 100644 --- a/include/configs/mx6qarm2.h +++ b/include/configs/mx6qarm2.h @@ -50,7 +50,7 @@ #define CONFIG_MMC #define CONFIG_CMD_MMC #define CONFIG_GENERIC_MMC -#define CONFIG_MMC_BOUNCE_BUFFER +#define CONFIG_BOUNCE_BUFFER #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION diff --git a/include/configs/mx6qsabre_common.h b/include/configs/mx6qsabre_common.h index bfb9cd4..a5c93d0 100644 --- a/include/configs/mx6qsabre_common.h +++ b/include/configs/mx6qsabre_common.h @@ -45,7 +45,7 @@ #define CONFIG_MMC #define CONFIG_CMD_MMC #define CONFIG_GENERIC_MMC -#define CONFIG_MMC_BOUNCE_BUFFER +#define CONFIG_BOUNCE_BUFFER #define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION diff --git a/include/configs/mx6qsabrelite.h b/include/configs/mx6qsabrelite.h index b56d7ca..a28d5a5 100644 --- a/include/configs/mx6qsabrelite.h +++ b/include/configs/mx6qsabrelite.h @@ -72,7 +72,7 @@ #define CONFIG_MMC #define CONFIG_CMD_MMC #define CONFIG_GENERIC_MMC -#define CONFIG_MMC_BOUNCE_BUFFER +#define CONFIG_BOUNCE_BUFFER #define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION diff --git a/include/configs/sc_sps_1.h b/include/configs/sc_sps_1.h index f5dc393..cb99d58 100644 --- a/include/configs/sc_sps_1.h +++ b/include/configs/sc_sps_1.h @@ -140,7 +140,7 @@ #ifdef CONFIG_CMD_MMC #define CONFIG_APBH_DMA #define CONFIG_MMC -#define CONFIG_MMC_BOUNCE_BUFFER +#define CONFIG_BOUNCE_BUFFER #define CONFIG_GENERIC_MMC #define CONFIG_MXS_MMC #endif -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V2 3/4] common: rework bouncebuf implementation
From: Stephen Warren swar...@nvidia.com The current bouncebuf API requires all parameters to be passed to both bounce_buffer_start() and bounce_buffer_stop(). Modify the bouncebuf start function to accept a state structure as a parameter, and only require that state struct to be passed to the stop function. This simplifies usage of the bounce buffer by clients. Don't modify the data pointer, but rather store the temporary buffer in this state struct. The bouncebuf code ensures that client code can always use a single buffer pointer in the state structure, irrespective of whether a bounce buffer actually had to be allocated. Move cache management logic into the bounce buffer code, so that each client doesn't have to duplicate this. I believe there's no need to invalidate the buffer before a DMA operation, since flushing the cache should prevent any write-backs. Update the MXS MMC driver for this change. Signed-off-by: Stephen Warren swar...@nvidia.com --- v2: * Move cache management into bounce buffer code. * Simplify addr_aligned(). * free() any allocated bounce buffer. * Added comments to struct bounce_buffer. * Change flags parameter from uint8_t to unsigned int. * s/bounce_buffer_state/bounce_buffer/. * Include linux/types.h in bouncebuf.h so it's self-contained. * Minor changes to rebase on top of earlier changed patches. --- common/bouncebuf.c | 75 +++-- drivers/mmc/mxsmmc.c | 30 --- include/bouncebuf.h | 33 -- 3 files changed, 72 insertions(+), 66 deletions(-) diff --git a/common/bouncebuf.c b/common/bouncebuf.c index 4f827f8..1df12cd 100644 --- a/common/bouncebuf.c +++ b/common/bouncebuf.c @@ -27,21 +27,19 @@ #include errno.h #include bouncebuf.h -static int addr_aligned(void *data, size_t len) +static int addr_aligned(struct bounce_buffer *state) { const ulong align_mask = ARCH_DMA_MINALIGN - 1; /* Check if start is aligned */ - if ((ulong)data align_mask) { - debug(Unaligned start address %p\n, data); + if ((ulong)state-user_buffer align_mask) { + debug(Unaligned buffer address %p\n, state-user_buffer); return 0; } - data += len; - - /* Check if end is aligned */ - if ((ulong)data align_mask) { - debug(Unaligned end address %p\n, data); + /* Check if length is aligned */ + if (state-len != state-len_aligned) { + debug(Unaligned buffer length %d\n, state-len); return 0; } @@ -49,44 +47,53 @@ static int addr_aligned(void *data, size_t len) return 1; } -int bounce_buffer_start(void **data, size_t len, void **backup, uint8_t flags) +int bounce_buffer_start(struct bounce_buffer *state, void *data, + size_t len, unsigned int flags) { - void *tmp; - size_t alen; - - if (addr_aligned(*data, len)) { - *backup = NULL; - return 0; + state-user_buffer = data; + state-bounce_buffer = data; + state-len = len; + state-len_aligned = roundup(len, ARCH_DMA_MINALIGN); + state-flags = flags; + + if (!addr_aligned(state)) { + state-bounce_buffer = memalign(ARCH_DMA_MINALIGN, + state-len_aligned); + if (!state-bounce_buffer) + return -ENOMEM; + + if (state-flags GEN_BB_READ) + memcpy(state-bounce_buffer, state-user_buffer, + state-len); } - alen = roundup(len, ARCH_DMA_MINALIGN); - tmp = memalign(ARCH_DMA_MINALIGN, alen); - - if (!tmp) - return -ENOMEM; - - if (flags GEN_BB_READ) - memcpy(tmp, *data, len); - - *backup = *data; - *data = tmp; + /* +* Flush data to RAM so DMA reads can pick it up, +* and any CPU writebacks don't race with DMA writes +*/ + flush_dcache_range((unsigned long)state-bounce_buffer, + (unsigned long)(state-bounce_buffer) + + state-len_aligned); return 0; } -int bounce_buffer_stop(void **data, size_t len, void **backup, uint8_t flags) +int bounce_buffer_stop(struct bounce_buffer *state) { - void *tmp = *data; + if (state-flags GEN_BB_WRITE) { + /* Invalidate cache so that CPU can see any newly DMA'd data */ + invalidate_dcache_range((unsigned long)state-bounce_buffer, + (unsigned long)(state-bounce_buffer) + + state-len_aligned); + } - /* The buffer was already aligned, since backup is NULL. */ - if (!*backup) + if (state-bounce_buffer == state-user_buffer) return 0; - if (flags
[U-Boot] [PATCH V2 2/4] bouncebuf: remove dummy implementation
From: Stephen Warren swar...@nvidia.com If any driver ever needs to use the bounce buffer API, it always needs to use it. As such, providing a dummy implementation of those APIs when CONFIG_BOUNCE_BUFFER isn't defined does not make sense. Remove the dummy implementation. Signed-off-by: Stephen Warren swar...@nvidia.com --- v2: New patch. --- include/bouncebuf.h | 14 -- 1 files changed, 0 insertions(+), 14 deletions(-) diff --git a/include/bouncebuf.h b/include/bouncebuf.h index 31021c5..aa2278c 100644 --- a/include/bouncebuf.h +++ b/include/bouncebuf.h @@ -51,7 +51,6 @@ */ #define GEN_BB_RW (GEN_BB_READ | GEN_BB_WRITE) -#ifdef CONFIG_BOUNCE_BUFFER /** * bounce_buffer_start() -- Start the bounce buffer session * data: pointer to buffer to be aligned @@ -70,18 +69,5 @@ int bounce_buffer_start(void **data, size_t len, void **backup, uint8_t flags); * flags: flags describing the transaction, see above. */ int bounce_buffer_stop(void **data, size_t len, void **backup, uint8_t flags); -#else -static inline int bounce_buffer_start(void **data, size_t len, void **backup, - uint8_t flags) -{ - return 0; -} - -static inline int bounce_buffer_stop(void **data, size_t len, void **backup, - uint8_t flags) -{ - return 0; -} -#endif #endif -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V2 4/4] mmc: tegra: use bounce buffer APIs
From: Stephen Warren swar...@nvidia.com Tegra's MMC driver does DMA, and hence needs cache-aligned buffers. In some cases (e.g. user load commands) this cannot be guaranteed by callers of the MMC APIs. To solve this, modify the Tegra MMC driver to use the new bounce_buffer_*() APIs. Note: Ideally, all U-Boot code will always provide address- and size- aligned buffers, so a bounce buffer will only ever be needed for user- supplied buffers (e.g. load commands). Ensuring this removes the need for performance-sucking bounce buffer cache management and memcpy()s. The one known exception at present is the SCR buffer in sd_change_freq(), which is only 8 bytes long. Solving this requires enhancing struct mmc_data to know the difference between buffer size and transferred data size, or forcing all callers of mmc_send_cmd() to have allocated buffers using ALLOC_CACHE_ALIGN_BUFFER(), which while true in this case, is not enforced in any way at present, and so cannot be assumed by the core MMC code. Signed-off-by: Stephen Warren swar...@nvidia.com -- v2: * Simplified patch by splitting bounce buffer API usage into a wrapper function, which calls mmc_send_cmd_bounced(); a renamed version of the original mmc_send_cmd(). * Adjusted for bouncebuffer patch changes --- drivers/mmc/tegra_mmc.c | 64 - include/configs/tegra20-common.h |3 ++ 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 1fd5592..d749ab0 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -19,6 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include bouncebuf.h #include common.h #include asm/gpio.h #include asm/io.h @@ -66,14 +67,17 @@ static void tegra_get_setup(struct mmc_host *host, int dev_index) host-reg = (struct tegra_mmc *)host-base; } -static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data) +static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data, + struct bounce_buffer *bbstate) { unsigned char ctrl; - debug(data-dest: %08X, data-blocks: %u, data-blocksize: %u\n, - (u32)data-dest, data-blocks, data-blocksize); - writel((u32)data-dest, host-reg-sysad); + debug(buf: %p (%p), data-blocks: %u, data-blocksize: %u\n, + bbstate-bounce_buffer, bbstate-user_buffer, data-blocks, + data-blocksize); + + writel((u32)bbstate-bounce_buffer, host-reg-sysad); /* * DMASEL[4:3] * 00 = Selects SDMA @@ -114,14 +118,6 @@ static void mmc_set_transfer_mode(struct mmc_host *host, struct mmc_data *data) if (data-flags MMC_DATA_READ) mode |= TEGRA_MMC_TRNMOD_DATA_XFER_DIR_SEL_READ; - if (data-flags MMC_DATA_WRITE) { - if ((uintptr_t)data-src (ARCH_DMA_MINALIGN - 1)) - printf(Warning: unaligned write to %p may fail\n, - data-src); - flush_dcache_range((ulong)data-src, (ulong)data-src + - data-blocks * data-blocksize); - } - writew(mode, host-reg-trnmod); } @@ -156,8 +152,8 @@ static int mmc_wait_inhibit(struct mmc_host *host, return 0; } -static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, - struct mmc_data *data) +static int mmc_send_cmd_bounced(struct mmc *mmc, struct mmc_cmd *cmd, + struct mmc_data *data, struct bounce_buffer *bbstate) { struct mmc_host *host = (struct mmc_host *)mmc-priv; int flags, i; @@ -172,7 +168,7 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, return result; if (data) - mmc_prepare_data(host, data); + mmc_prepare_data(host, data, bbstate); debug(cmd-arg: %08x\n, cmd-cmdarg); writel(cmd-cmdarg, host-reg-argument); @@ -322,20 +318,42 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, } } writel(mask, host-reg-norintsts); - if (data-flags MMC_DATA_READ) { - if ((uintptr_t)data-dest (ARCH_DMA_MINALIGN - 1)) - printf(Warning: unaligned read from %p - may fail\n, data-dest); - invalidate_dcache_range((ulong)data-dest, - (ulong)data-dest + - data-blocks * data-blocksize); - } } udelay(1000); return 0; } +static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, + struct mmc_data *data) +{ + void *buf; + unsigned int bbflags; + size_t len; + struct bounce_buffer bbstate; + int ret; + + if (data) { +
[U-Boot] [PATCH] am335x_evm: Fix Ethernet LED issue on BeagleBone
The default value for PRM_RSTTIME1 on am335x is 0x06 leading to a very short assertion of SYS_RESETn on BeagleBones. For PRM_RSTTIME1 values less than 0x80, some BeagleBones will end up with inverted Ethernet LEDs upon warm software reset leading to incorrect display of the Ethernet link status on the Ethernet jack. Extend PRM_RSTTIME1 to 0x80 to provide a longer assertion of SYS_RESETn allowing the SMSC PHY more time to sample the strapping resistors which set the LED orientation. Signed-off-by: Andrew Bradford and...@bradfordembedded.com --- arch/arm/include/asm/arch-am33xx/cpu.h |1 + board/ti/am335x/board.c|8 2 files changed, 9 insertions(+) diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h index 819fd2f..bcd2fb0 100644 --- a/arch/arm/include/asm/arch-am33xx/cpu.h +++ b/arch/arm/include/asm/arch-am33xx/cpu.h @@ -53,6 +53,7 @@ /* Reset control */ #ifdef CONFIG_AM33XX #define PRM_RSTCTRL0x44E00F00 +#define PRM_RSTTIME0x44E00F04 #define PRM_RSTST 0x44E00F08 #endif #define PRM_RSTCTRL_RESET 0x01 diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b56a801..7c23a6e 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -304,6 +304,14 @@ void s_init(void) else config_ddr(266, MT47H128M16RT25E_IOCTRL_VALUE, ddr2_data, ddr2_cmd_ctrl_data, ddr2_emif_reg_data); + + if (board_is_bone()) + /* +* For BeagleBone, extend PRM_RSTTIME1 to ensure SMSC PHY +* strapping resistors are properly read on warm software reset +* to reduce the chance of Ethernet LEDs being inverted. +*/ + writeb(0x80, PRM_RSTTIME); #endif } -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 2/9] x86: Allow excluding reset vector code from u-boot
From: Gabe Black gabebl...@chromium.org When running from coreboot we don't want this code. This version works by ifdef-ing out all of the code that would go into those sections and all the code that refers to it. The sections are then empty, and the linker will either leave them empty for the loader to ignore or remove them entirely. Signed-off-by: Gabe Black gabebl...@chromium.org Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: - Fix incorrect repeated line in Makefile Changes in v2: - Put CONFIG_NO_RESET_CODE into Makefile instead of source files Makefile|6 -- arch/x86/cpu/Makefile |5 - arch/x86/cpu/u-boot.lds |3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9dc89f9..e963bf2 100644 --- a/Makefile +++ b/Makefile @@ -231,8 +231,10 @@ endif OBJS = $(CPUDIR)/start.o ifeq ($(CPU),x86) -OBJS += $(CPUDIR)/start16.o -OBJS += $(CPUDIR)/resetvec.o + ifneq ($(CONFIG_NO_RESET_CODE),y) + OBJS += $(CPUDIR)/start16.o + OBJS += $(CPUDIR)/resetvec.o + endif endif ifeq ($(CPU),ppc4xx) OBJS += $(CPUDIR)/resetvec.o diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 7f1fc18..1eb70a7 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -28,7 +28,10 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(CPU).o -START = start.o start16.o resetvec.o +START = start.o +ifneq ($(CONFIG_NO_RESET_CODE),y) +START += resetvec.o start16.o +endif COBJS = interrupts.o cpu.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index a1ecefa..e20bb02 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -86,6 +86,8 @@ SECTIONS __bios_start = LOADADDR(.bios); __bios_size = SIZEOF(.bios); +#ifndef CONFIG_NO_RESET_CODE + /* * The following expressions place the 16-bit Real-Mode code and * Reset Vector at the end of the Flash ROM @@ -95,4 +97,5 @@ SECTIONS . = RESET_VEC_LOC; .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); } +#endif } -- 1.7.7.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
On 11/06/2012 02:26 PM, Allen Martin wrote: Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue, but this allows arrow keys to work until this driver is converted. Tested-by: Stephen Warren swar...@nvidia.com ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] video: Provide an API to access video parameters
From: Stefan Reinauer reina...@chromium.org Create a basic API to provide access to video parameters such as screen size, and to position the cursor on the screen. Also add a prototype for video_display_bitmap() which was missing. Signed-off-by: Stefan Reinauer reina...@chromium.org Signed-off-by: Simon Glass s...@chromium.org Signed-off-by: Anatolij Gustschin ag...@denx.de --- Changes in v2: - include video.h in cmd_bmp.c to fix compiler warning: cmd_bmp.c:242:2: warning: implicit declaration of function 'video_display_bitmap' [-Wimplicit-function-declaration] common/cmd_bmp.c |5 ++--- include/video.h | 48 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index b8809e3..5a52edd 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -31,6 +31,7 @@ #include command.h #include asm/byteorder.h #include malloc.h +#include video.h static int bmp_info (ulong addr); @@ -238,9 +239,7 @@ int bmp_display(ulong addr, int x, int y) #if defined(CONFIG_LCD) ret = lcd_display_bitmap((ulong)bmp, x, y); #elif defined(CONFIG_VIDEO) - extern int video_display_bitmap (ulong, int, int); - - ret = video_display_bitmap ((unsigned long)bmp, x, y); + ret = video_display_bitmap((unsigned long)bmp, x, y); #else # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO #endif diff --git a/include/video.h b/include/video.h index 9519cea..f7e27f8 100644 --- a/include/video.h +++ b/include/video.h @@ -15,4 +15,52 @@ int video_init (void *videobase); void video_putc (const char c); void video_puts (const char *s); +/** + * Display a BMP format bitmap on the screen + * + * @param bmp_imageAddress of BMP image + * @param xX position to draw image + * @param yY position to draw image + */ +int video_display_bitmap(ulong bmp_image, int x, int y); + +/** + * Get the width of the screen in pixels + * + * @return width of screen in pixels + */ +int video_get_pixel_width(void); + +/** + * Get the height of the screen in pixels + * + * @return height of screen in pixels + */ +int video_get_pixel_height(void); + +/** + * Get the number of text lines/rows on the screen + * + * @return number of rows + */ +int video_get_screen_rows(void); + +/** + * Get the number of text columns on the screen + * + * @return number of columns + */ +int video_get_screen_columns(void); + +/** + * Set the position of the text cursor + * + * @param col Column to place cursor (0 = left side) + * @param row Row to place cursor (0 = top line) + */ +void video_position_cursor(unsigned col, unsigned row); + +/* Clear the display */ +void video_clear(void); + #endif -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands
Hi Wolfgang, On Mon, Nov 5, 2012 at 11:27 PM, Wolfgang Denk w...@denx.de wrote: Dear Simon Glass, In message capnjgz0stfp2ucfn4tmdpg_x-4vdw7gxodsscgsbq6sum0o...@mail.gmail.com you wrote: Well I found a very short version: * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. but it is inaccurate. We could perhaps change it to: * Use of this source code is governed by a BSD-style license that can be * found in the COPYING file. or something similar? But so much of U-Boot already has the full version that I'm not sure this is a good idea. Here is the one I am using # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. Note that this is the GPL, and _not_ any BSD-style license ! Yes. I've gone with the longer one, just removing the CREDITS. That seems to be the most common message in U-Boot. Regards, Simon Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Children begin by loving their parents. After a time they judge them. Rarely, if ever, do they forgive them. - Oscar Wilde ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands
Dear Simon Glass, In message CAPnjgZ1DbXwS=bgzLecoLM-V0785Zi6bytKTM=rp2ecnskt...@mail.gmail.com you wrote: Well I found a very short version: * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. but it is inaccurate. We could perhaps change it to: * Use of this source code is governed by a BSD-style license that can be * found in the COPYING file. or something similar? But so much of U-Boot already has the full version that I'm not sure this is a good idea. Here is the one I am using # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. Note that this is the GPL, and _not_ any BSD-style license ! Yes. I've gone with the longer one, just removing the CREDITS. That seems to be the most common message in U-Boot. You appear to miss the point. You switched the licensing model from BSD to GPL - not that I would complain about such a move, on contrary, but I wonder if this is intentional and agreed by the authors of the code? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de The sight of death frightens them [Earthers]. -- Kras the Klingon, Friday's Child, stardate 3497.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/7] fs: Add a Coreboot Filesystem (CBFS) driver and commands
Hi Wolfgang, On Tue, Nov 6, 2012 at 2:23 PM, Wolfgang Denk w...@denx.de wrote: Dear Simon Glass, In message CAPnjgZ1DbXwS=bgzLecoLM-V0785Zi6bytKTM=rp2ecnskt...@mail.gmail.com you wrote: Well I found a very short version: * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. but it is inaccurate. We could perhaps change it to: * Use of this source code is governed by a BSD-style license that can be * found in the COPYING file. or something similar? But so much of U-Boot already has the full version that I'm not sure this is a good idea. Here is the one I am using # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. Note that this is the GPL, and _not_ any BSD-style license ! Yes. I've gone with the longer one, just removing the CREDITS. That seems to be the most common message in U-Boot. You appear to miss the point. You switched the licensing model from BSD to GPL - not that I would complain about such a move, on contrary, but I wonder if this is intentional and agreed by the authors of the code? Yes I am now completely lost :-) Where have I changed the licensing model? Your original request was to remove the CREDITS line I think. I have done that in this patch: http://patchwork.ozlabs.org/patch/197314/ The above discussion about copyright message is separate to that. I was looking around the code base for a possible replacement (shorter) message because I thought that was what you were looking for. I found the BSD one, but have not changed any code to use it. So yes, please can you explain what I am missing here? Regards, Simon Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de The sight of death frightens them [Earthers]. -- Kras the Klingon, Friday's Child, stardate 3497.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/3] md5: Fix gcc-4.7 build problem in md5
Dear Pavel Machek, On Tue 2012-11-06 01:56:50, Marek Vasut wrote: Dear Pavel Machek, Hi! In message 20121105200340.GA15821@xo-6d-61-c0.localdomain you wrote: /* Append length in bits and transform */ - ctx-in32[14] = ctx-bits[0]; - ctx-in32[15] = ctx-bits[1]; + memcpy(ctx-in + 14 * sizeof(__u32), ctx-bits, 2 * sizeof(__u32)); Is there some alternate solution? The memcpy is really ugly... Plus... does it solve the issue? The code does not look like being compatible with strict pointer aliasing... and I don't think memcpy() helps. arch/nds32/config.mk:PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax arch/x86/config.mk:PLATFORM_CPPFLAGS += -fno-strict-aliasing We should really do that globally. Were you even able to replicate this problem in the first place? Isn't this whole problem a problem of a broken (ubuntu/linaro) toolchain again? This is not something you can replicate. At least md5 code is unsafe with strict aliasing, probably most of u-boot, because low-level people write code like that. Thus we should do -fno-strict-aliasing. Otherwise compiler may decide in future to miscompile our code, even if it compiles it correctly now. Pavel I dont think -fno-strict-aliasing is the way to go, it'll only hide the problem, no? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] usb: ehci: Take advantage of the new multi-controller feature for MXC
Dear Lucas Stach, [...] What do you think? What about passing port private / platform data instead of ID ? The ID is already passed to ehci_hcd_init(), so we have to live with it if we don't want to change the newly introduced multi-controller infrastructure. Let's change it remove the ID and pass some generic pdata. I don't like the idea of passing around data at this level. It's breaking the abstraction, as we have to pass low-level usb information around in the higher USB stack levels. Good, what do you suggest we do when we apply driver model onto this stuff? The USB driver code should be able to do the virt-to-phys controller mapping on it's own. In the Tegra world Tegra is completely unimportant part of the usb ecosystem. we use the information we get from device tree to do so, but I don't see a reason why your USB host driver code wouldn't be able to just require an array with configuration data from the board file. I don't see how you transfer DT information into controller # ... There is really no need to pass this information through all the USB stack interfaces. Please explain. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] usb: ehci: Take advantage of the new multi-controller feature for MXC
Dear Benoît Thébaudeau, Dear Lucas Stach, On Tuesday, November 6, 2012 8:43:43 AM, Lucas Stach wrote: Am Dienstag, den 06.11.2012, 00:56 +0100 schrieb Marek Vasut: Dear Benoît Thébaudeau, Dear Marek Vasut, On Monday, November 5, 2012 11:54:12 PM, Marek Vasut wrote: Dear Benoît Thébaudeau, Hi Marek, Thanks to Lucas' series coming with commits c7e3b2b and 676ae06, I'd like to use the multi-controller feature on MXC since most of these SoCs come with a USB IP supporting an OTG controller and multiple host-only controllers. Currently the MXC code in ehci-mx{c|5|6}.c just ignores the index passed to ehci_hcd_init() and the like, and there are 3 port-specific configs (CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS and CONFIG_MXC_USB_PORTSC). Not all USB ports from the USB IP will be available on each board for a given SoC, so we need a logical to physical USB port mapping. I would suggest something like the following. board.h: #define CONFIG_MXC_USB { \ { \ 0, \ MXC_EHCI_INTERNAL_PHY, \ MXC_EHCI_UTMI_16BIT | MXC_EHCI_MODE_UTMI \ }, { \ 1, \ MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_PWR_PIN_ACTIVE_HIGH | \ MXC_EHCI_OC_PIN_ACTIVE_LOW, \ MXC_EHCI_MODE_ULPI \ }, \ } ehci-fsl.h: struct mxc_ehci_cfg { int port; u32 flags; u32 portsc; }; ehci-mx{c|5|6}.c: static const struct mxc_ehci_cfg cfg[CONFIG_USB_MAX_CONTROLLER_COUNT] = CONFIG_MXC_USB; Then, in ehci_hcd_init(), there would be the following replacements: - CONFIG_MXC_USB_PORT - cfg[index].port, - CONFIG_MXC_USB_FLAGS - cfg[index].flags, - CONFIG_MXC_USB_PORTSC - cfg[index].portsc. What do you think? What about passing port private / platform data instead of ID ? The ID is already passed to ehci_hcd_init(), so we have to live with it if we don't want to change the newly introduced multi-controller infrastructure. Let's change it remove the ID and pass some generic pdata. I don't like the idea of passing around data at this level. It's breaking the abstraction, as we have to pass low-level usb information around in the higher USB stack levels. The USB driver code should be able to do the virt-to-phys controller mapping on it's own. In the Tegra world we use the information we get from device tree to do so, but I don't see a reason why your USB host driver code wouldn't be able to just require an array with configuration data from the board file. There is really no need to pass this information through all the USB stack interfaces. I agree, all the more ehci_hcd_init() is called from cmd_usb.c, completely outside of any board init context, so collecting the platform data would be a real pain, without bringing much. And moving usb_init() calls to board init context would also not be good because of the added boot time. IMHO, the best solutions here are either a CONFIG_MXC_USB as I suggested, or the same structure passed to some init function specific to these EHCI drivers (which would add more code for little benefit). I disagree ... mapping function is fine, but I'd like to be able to pass around pointer to some platform data. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
Dear Stephen Warren, On 11/05/2012 05:54 PM, Marek Vasut wrote: Dear Stephen Warren, From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Uh, don't you want the bounce buffer not compiled in for SPL? Then maybe add CONFIG_SPL_BOUNCE_BUFFER to force BB to be compiled into SPL or something ... Not compiling bouncebuf.c for SPL would solve this too. I have no idea what build system contortions would be required to do this though. Do you think the build system should be fixed first rather than taking this series/patch? I guess we shouldn't need a separate CONFIG_SPL_BOUNCE_BUFFER option though; we should rather simply set CONFIG_SPL_BOUNCE_BUFFER appropriately for SPL and non-SPL, and have everything key off that one variable, right? How will you be able to configure it separately for spl and non-spl ? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
On 11/06/2012 03:43 PM, Marek Vasut wrote: Dear Stephen Warren, On 11/05/2012 05:54 PM, Marek Vasut wrote: Dear Stephen Warren, From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Uh, don't you want the bounce buffer not compiled in for SPL? Then maybe add CONFIG_SPL_BOUNCE_BUFFER to force BB to be compiled into SPL or something ... Not compiling bouncebuf.c for SPL would solve this too. I have no idea what build system contortions would be required to do this though. Do you think the build system should be fixed first rather than taking this series/patch? I guess we shouldn't need a separate CONFIG_SPL_BOUNCE_BUFFER option though; we should rather simply set CONFIG_SPL_BOUNCE_BUFFER appropriately for SPL and non-SPL, and have everything key off that one variable, right? How will you be able to configure it separately for spl and non-spl ? For example, include/configs/trimslice.h contains: /* SD/MMC */ #define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_TEGRA_MMC #define CONFIG_CMD_MMC However, we don't use MMC in our SPL, but don't want to pollute every Tegra board file with ifdefs for SPL, so include/configs/tegra-common-post.h (which is included at the end of trimslice.h) contains: #ifdef CONFIG_SPL_BUILD ... /* remove MMC support */ #ifdef CONFIG_MMC #undef CONFIG_MMC #endif #ifdef CONFIG_GENERIC_MMC #undef CONFIG_GENERIC_MMC #endif #ifdef CONFIG_TEGRA_MMC #undef CONFIG_TEGRA_MMC #endif #ifdef CONFIG_CMD_MMC #undef CONFIG_CMD_MMC #endif ... #endif And in the V1 patch I proposed to tegra-common-post.h, I added the following at the end: #ifdef CONFIG_TEGRA_MMC #define CONFIG_BOUNCE_BUFFER #endif ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin amar...@nvidia.com --- [...] Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
Hi Marek, On Tue, Nov 6, 2012 at 2:49 PM, Marek Vasut ma...@denx.de wrote: Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( Because it's a fair chunk of work, and also if we are doing USB we should probably do keyboard.c first. USB would not be the first priority since so much of the logic / keycodes are different. Regards, Simon but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin amar...@nvidia.com --- [...] Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
On Tue, Nov 6, 2012 at 1:26 PM, Allen Martin amar...@nvidia.com wrote: Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue, but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin amar...@nvidia.com Tested-by: Simon Glass s...@chromium.org Acked-by: Simon Glass s...@chromium.org --- common/usb_kbd.c | 13 + 1 file changed, 13 insertions(+) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 24467ce..4efbcfe 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -94,6 +94,15 @@ static const unsigned char usb_kbd_num_keypad[] = { }; /* + * map arrow keys to ^F/^B ^N/^P, can't really use the proper + * ANSI sequence for arrow keys because the queuing code breaks + * when a single keypress expands to 3 queue elements + */ +static const unsigned char usb_kbd_arrow[] = { + 0x6, 0x2, 0xe, 0x10 +}; + +/* * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this * order. See usb_kbd_setled() function! */ @@ -224,6 +233,10 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode, keycode = usb_kbd_numkey[scancode - 0x1e]; } + /* Arrow keys */ + if ((scancode = 0x4f) (scancode = 0x52)) + keycode = usb_kbd_arrow[scancode - 0x4f]; + /* Numeric keypad */ if ((scancode = 0x54) (scancode = 0x67)) keycode = usb_kbd_num_keypad[scancode - 0x54]; -- 1.7.10.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2 1/4] Replace CONFIG_MMC_BOUNCE_BUFFER with CONFIG_BOUNCE_BUFFER in configs
On Tue, Nov 6, 2012 at 1:27 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com Commits 6dc71c8 MMC: MXS: Toggle the generic bounce buffer on the boards and 49a627f MMC: Remove the MMC bounce buffer replaced CONFIG_MMC_BOUNCE_BUFFER with CONFIG_BOUNCE_BUFFER, but missed converting a few boards over to the new option. Fix this. Signed-off-by: Stephen Warren swar...@nvidia.com Tested on Seaboard, loading a kernel from ext2 partition. Acked-by: Simon Glass s...@chromium.org Tested-by: Simon Glass s...@chromium.org ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2 3/4] common: rework bouncebuf implementation
On Tue, Nov 6, 2012 at 1:27 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com The current bouncebuf API requires all parameters to be passed to both bounce_buffer_start() and bounce_buffer_stop(). Modify the bouncebuf start function to accept a state structure as a parameter, and only require that state struct to be passed to the stop function. This simplifies usage of the bounce buffer by clients. Don't modify the data pointer, but rather store the temporary buffer in this state struct. The bouncebuf code ensures that client code can always use a single buffer pointer in the state structure, irrespective of whether a bounce buffer actually had to be allocated. Move cache management logic into the bounce buffer code, so that each client doesn't have to duplicate this. I believe there's no need to invalidate the buffer before a DMA operation, since flushing the cache should prevent any write-backs. Update the MXS MMC driver for this change. Signed-off-by: Stephen Warren swar...@nvidia.com Tested on Seaboard, loading a kernel from ext2 partition. Acked-by: Simon Glass s...@chromium.org Tested-by: Simon Glass s...@chromium.org This is a really nice change, thank you Stephen. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2 2/4] bouncebuf: remove dummy implementation
On Tue, Nov 6, 2012 at 1:27 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com If any driver ever needs to use the bounce buffer API, it always needs to use it. As such, providing a dummy implementation of those APIs when CONFIG_BOUNCE_BUFFER isn't defined does not make sense. Remove the dummy implementation. Signed-off-by: Stephen Warren swar...@nvidia.com Tested on Seaboard, loading a kernel from ext2 partition. Acked-by: Simon Glass s...@chromium.org Tested-by: Simon Glass s...@chromium.org ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 1/2] video: atmel: implement lcd_setcolreg funtion
Dear Andreas Bießmann, From: Bo Shen voice.s...@atmel.com Missing commit message Signed-off-by: Bo Shen voice.s...@atmel.com Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com --- since v2: * add this single patch drivers/video/atmel_hlcdfb.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c index beb7fa3..4110d4d 100644 --- a/drivers/video/atmel_hlcdfb.c +++ b/drivers/video/atmel_hlcdfb.c @@ -51,6 +51,12 @@ short console_row; #define lcdc_readl(reg) __raw_readl((reg)) #define lcdc_writel(reg, val)__raw_writel((val), (reg)) +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) +{ + lcdc_writel((red 16) | (green 8) | blue, + panel_info.mmio + ATMEL_LCDC_LUT(regno)); So this is RGB666? Or what are those magic numbers ? +} + void lcd_ctrl_init(void *lcdbase) { unsigned long value; Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2 4/4] mmc: tegra: use bounce buffer APIs
Hi Stephen, On Tue, Nov 6, 2012 at 1:27 PM, Stephen Warren swar...@wwwdotorg.org wrote: From: Stephen Warren swar...@nvidia.com Tegra's MMC driver does DMA, and hence needs cache-aligned buffers. In some cases (e.g. user load commands) this cannot be guaranteed by callers of the MMC APIs. To solve this, modify the Tegra MMC driver to use the new bounce_buffer_*() APIs. Note: Ideally, all U-Boot code will always provide address- and size- aligned buffers, so a bounce buffer will only ever be needed for user- supplied buffers (e.g. load commands). Ensuring this removes the need for performance-sucking bounce buffer cache management and memcpy()s. The one known exception at present is the SCR buffer in sd_change_freq(), which is only 8 bytes long. Solving this requires enhancing struct mmc_data to know the difference between buffer size and transferred data size, or forcing all callers of mmc_send_cmd() to have allocated buffers using ALLOC_CACHE_ALIGN_BUFFER(), which while true in this case, is not enforced in any way at present, and so cannot be assumed by the core MMC code. Signed-off-by: Stephen Warren swar...@nvidia.com Tested on Seaboard, loading a kernel from ext2 partition. Acked-by: Simon Glass s...@chromium.org Tested-by: Simon Glass s...@chromium.org It's really nice to clean up the cache code as well, very slick. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
On Tue, Nov 06, 2012 at 02:49:29PM -0800, Marek Vasut wrote: Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( It would be a lot more work to do that. This patch just adds support for 4 new keys without rocking the boat too much. I wasn't quite ready to signup to porting the whole driver over as there's a bunch things I want to work on inside tegra first. -Allen -- nvpublic ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
Dear Simon Glass, Hi Marek, On Tue, Nov 6, 2012 at 2:49 PM, Marek Vasut ma...@denx.de wrote: Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( Because it's a fair chunk of work Let's either do it properly or not at all ... if I let you do these semi- complete fixes, we'll end up with a stinking pile of crap like windows ... and also if we are doing USB we should probably do keyboard.c first. Uh, I don't follow. USB would not be the first priority since so much of the logic / keycodes are different. Sorry, I'm completely lost. Regards, Simon but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin amar...@nvidia.com --- [...] Best regards, Marek Vasut Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
Dear Stephen Warren, On 11/06/2012 03:43 PM, Marek Vasut wrote: Dear Stephen Warren, On 11/05/2012 05:54 PM, Marek Vasut wrote: Dear Stephen Warren, From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Uh, don't you want the bounce buffer not compiled in for SPL? Then maybe add CONFIG_SPL_BOUNCE_BUFFER to force BB to be compiled into SPL or something ... Not compiling bouncebuf.c for SPL would solve this too. I have no idea what build system contortions would be required to do this though. Do you think the build system should be fixed first rather than taking this series/patch? I guess we shouldn't need a separate CONFIG_SPL_BOUNCE_BUFFER option though; we should rather simply set CONFIG_SPL_BOUNCE_BUFFER appropriately for SPL and non-SPL, and have everything key off that one variable, right? How will you be able to configure it separately for spl and non-spl ? For example, include/configs/trimslice.h contains: /* SD/MMC */ #define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_TEGRA_MMC #define CONFIG_CMD_MMC However, we don't use MMC in our SPL, but don't want to pollute every Tegra board file with ifdefs for SPL, so include/configs/tegra-common-post.h (which is included at the end of trimslice.h) contains: #ifdef CONFIG_SPL_BUILD ... /* remove MMC support */ #ifdef CONFIG_MMC #undef CONFIG_MMC #endif #ifdef CONFIG_GENERIC_MMC #undef CONFIG_GENERIC_MMC #endif #ifdef CONFIG_TEGRA_MMC #undef CONFIG_TEGRA_MMC #endif #ifdef CONFIG_CMD_MMC #undef CONFIG_CMD_MMC #endif ... #endif And in the V1 patch I proposed to tegra-common-post.h, I added the following at the end: #ifdef CONFIG_TEGRA_MMC #define CONFIG_BOUNCE_BUFFER #endif Yet, this doesn't solve the problem with SPL ... since for SPL, you'd have to do ifdef CONFIG_SPL, no? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] usb: ehci: Take advantage of the new multi-controller feature for MXC
Dear Marek Vasut, Am Dienstag, den 06.11.2012, 23:35 +0100 schrieb Marek Vasut: Dear Lucas Stach, [...] What do you think? What about passing port private / platform data instead of ID ? The ID is already passed to ehci_hcd_init(), so we have to live with it if we don't want to change the newly introduced multi-controller infrastructure. Let's change it remove the ID and pass some generic pdata. I don't like the idea of passing around data at this level. It's breaking the abstraction, as we have to pass low-level usb information around in the higher USB stack levels. Good, what do you suggest we do when we apply driver model onto this stuff? Sadly I have not found the time to take a deeper look into the driver model. But see below. The USB driver code should be able to do the virt-to-phys controller mapping on it's own. In the Tegra world Tegra is completely unimportant part of the usb ecosystem. I know that your views are centred around a different point, which is fine with me, but please don't make the mistake to downplay the importance of _any_ part of the ecosystem. we use the information we get from device tree to do so, but I don't see a reason why your USB host driver code wouldn't be able to just require an array with configuration data from the board file. I don't see how you transfer DT information into controller # ... There is really no need to pass this information through all the USB stack interfaces. Please explain. Tegra has a two step initialisation: 1. Init the driver at board_init time This is the step where we parse all the DT information and fill in all needed driver internal structures. At this point we do the virt to phys controller ID mapping. 2. For every controller that U-Boot really uses we activate host mode and do the real hardware initialisation at ehci_hcd_init time. If I'm not completely mistaken such a model should align nicely with the upcoming driver model. The driver gets instantiated with information it gathers from global platform data, may it be device tree or any other form of driver related information. In this case the ehci_hcd_init|stop entry points are only used to init/stop one specific controller, which is completely different matter from the driver being instantiated and as such should not carry any platform data. IMHO all platform data should be contained in the boards global data. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Merging device trees at runtime for module-based systems
On Wed, Oct 31, 2012 at 11:00 PM, Daniel Mack zon...@gmail.com wrote: cc devicetree-discuss. Here's a reference to the full thread: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/145221/ Interesting. I only just was made aware of this thread. There is a similar discussion going on kicked off by the BeagleBone folks where they want to insert additional DT data from Linux userspace. Whether the data is merged at U-Boot time or kernel time, I expect that the required data format will be very similar. https://lkml.org/lkml/2012/10/31/502 https://lkml.org/lkml/2012/11/5/615 I'm trying to draft up a document that captures the requirements and lay out what needs to be done to the tools, U-Boot and the kernel. g. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 0/8] NAND support for AM33XX
These series add support for NAND on AM33XX. AM33XX has the same GPMC controller as OMAP3 so the first part of the series just add required defines/initialization to enable the existing omap_gpmc driver to work on AM33XX. The rest of the series adds support for BCH8 error correction code. We use GPMC to generate codes/syndromes and ELM to find the errors. Changes in v2: -fix nand mux settings (profiles 23 don't have NAND) - rebased on current master - clean up mem.c (remove unused stuff that was copied from OMAP3) - nand headers: remove unneeded stuff - rebased onto master - minor config style fix (wrt nand) - fix wrong braces in Makefile Ilya Yanok (6): OMAP: include sys_proto.h from boot-common am335x_evm: add nand pinmux definition am33xx: NAND support am335x_evm: enable NAND support am33xx_spl_bch: simple SPL nand loader for AM33XX am335x_evm: enable SPL NAND support Mansoor Ahamed (2): am33xx: add ELM support omap_gpmc: BCH8 support (ELM based) arch/arm/cpu/armv7/am33xx/Makefile |2 + arch/arm/cpu/armv7/am33xx/board.c|1 + arch/arm/cpu/armv7/am33xx/clock.c| 10 + arch/arm/cpu/armv7/am33xx/elm.c | 212 ++ arch/arm/cpu/armv7/am33xx/mem.c | 101 +++ arch/arm/cpu/armv7/omap-common/boot-common.c |1 + arch/arm/include/asm/arch-am33xx/cpu.h | 53 arch/arm/include/asm/arch-am33xx/elm.h | 93 ++ arch/arm/include/asm/arch-am33xx/hardware.h |3 + arch/arm/include/asm/arch-am33xx/mem.h | 83 ++ arch/arm/include/asm/arch-am33xx/omap_gpmc.h | 120 arch/arm/include/asm/arch-am33xx/sys_proto.h |3 + board/ti/am335x/board.c |2 + board/ti/am335x/mux.c| 22 ++ drivers/mtd/nand/Makefile|1 + drivers/mtd/nand/am335x_spl_bch.c| 238 +++ drivers/mtd/nand/omap_gpmc.c | 403 +- include/configs/am335x_evm.h | 46 +++ 18 files changed, 1393 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/armv7/am33xx/elm.c create mode 100644 arch/arm/cpu/armv7/am33xx/mem.c create mode 100644 arch/arm/include/asm/arch-am33xx/elm.h create mode 100644 arch/arm/include/asm/arch-am33xx/mem.h create mode 100644 arch/arm/include/asm/arch-am33xx/omap_gpmc.h create mode 100644 drivers/mtd/nand/am335x_spl_bch.c -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/8] OMAP: include sys_proto.h from boot-common
Include asm/arch/sys_proto.h for gpmc_init prototype. Without this we get a warning while building for AM335x. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- arch/arm/cpu/armv7/omap-common/boot-common.c |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c index 0f19141..2b584e0 100644 --- a/arch/arm/cpu/armv7/omap-common/boot-common.c +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c @@ -21,6 +21,7 @@ #include asm/omap_common.h #include asm/arch/omap.h #include asm/arch/mmc_host_def.h +#include asm/arch/sys_proto.h /* * This is used to verify if the configuration header -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/8] am335x_evm: add nand pinmux definition
Add NAND pins mux settings for AM335X devices. Enable NAND pins for AM335X EVM board. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v2: -fix nand mux settings (profiles 23 don't have NAND) board/ti/am335x/mux.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c index 8437ef5..0283708 100644 --- a/board/ti/am335x/mux.c +++ b/board/ti/am335x/mux.c @@ -171,6 +171,25 @@ static struct module_pin_mux mii1_pin_mux[] = { {-1}, }; +static 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 */ + {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD2 */ + {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD3 */ + {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD4 */ + {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */ + {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */ + {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */ + {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */ + {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */ + {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */ + {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */ + {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)}, /* NAND_OE */ + {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)}, /* NAND_WEN */ + {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)}, /* NAND_BE_CLE */ + {-1}, +}; + void enable_uart0_pin_mux(void) { configure_module_pin_mux(uart0_pin_mux); @@ -257,6 +276,9 @@ void enable_board_pin_mux(struct am335x_baseboard_id *header) /* In profile #2 i2c1 and spi0 conflict. */ if (profile ~PROFILE_2) configure_module_pin_mux(i2c1_pin_mux); + /* Profiles 2 3 don't have NAND */ + if (profile ~(PROFILE_2 | PROFILE_3)) + configure_module_pin_mux(nand_pin_mux); else if (profile == PROFILE_2) { configure_module_pin_mux(mmc1_pin_mux); configure_module_pin_mux(spi0_pin_mux); -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 3/8] am33xx: NAND support
TI AM33XX has the same GPMC controller as OMAP3 so we could just use the existing omap_gpmc driver. This patch adds adds required definitions/intialization. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v2: - rebased on current master - clean up mem.c (remove unused stuff that was copied from OMAP3) - nand headers: remove unneeded stuff arch/arm/cpu/armv7/am33xx/Makefile |1 + arch/arm/cpu/armv7/am33xx/board.c|1 + arch/arm/cpu/armv7/am33xx/clock.c|5 ++ arch/arm/cpu/armv7/am33xx/mem.c | 101 ++ arch/arm/include/asm/arch-am33xx/cpu.h | 53 arch/arm/include/asm/arch-am33xx/hardware.h |3 + arch/arm/include/asm/arch-am33xx/mem.h | 83 ++ arch/arm/include/asm/arch-am33xx/omap_gpmc.h | 120 ++ arch/arm/include/asm/arch-am33xx/sys_proto.h |3 + 9 files changed, 370 insertions(+) create mode 100644 arch/arm/cpu/armv7/am33xx/mem.c create mode 100644 arch/arm/include/asm/arch-am33xx/mem.h create mode 100644 arch/arm/include/asm/arch-am33xx/omap_gpmc.h diff --git a/arch/arm/cpu/armv7/am33xx/Makefile b/arch/arm/cpu/armv7/am33xx/Makefile index 74875b3..f565357 100644 --- a/arch/arm/cpu/armv7/am33xx/Makefile +++ b/arch/arm/cpu/armv7/am33xx/Makefile @@ -18,6 +18,7 @@ LIB = $(obj)lib$(SOC).o COBJS += clock.o COBJS += sys_info.o +COBJS += mem.o COBJS += ddr.o COBJS += emif4.o COBJS += board.o diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index e4c123c..c756c09 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -25,6 +25,7 @@ #include asm/arch/ddr_defs.h #include asm/arch/clock.h #include asm/arch/gpio.h +#include asm/arch/mem.h #include asm/arch/mmc_host_def.h #include asm/arch/sys_proto.h #include asm/io.h diff --git a/arch/arm/cpu/armv7/am33xx/clock.c b/arch/arm/cpu/armv7/am33xx/clock.c index bc2abb6..6eb7d9f 100644 --- a/arch/arm/cpu/armv7/am33xx/clock.c +++ b/arch/arm/cpu/armv7/am33xx/clock.c @@ -150,6 +150,11 @@ static void enable_per_clocks(void) ; #endif /* CONFIG_SERIAL6 */ + /* GPMC */ + writel(PRCM_MOD_EN, cmper-gpmcclkctrl); + while (readl(cmper-gpmcclkctrl) != PRCM_MOD_EN) + ; + /* MMC0*/ writel(PRCM_MOD_EN, cmper-mmc0clkctrl); while (readl(cmper-mmc0clkctrl) != PRCM_MOD_EN) diff --git a/arch/arm/cpu/armv7/am33xx/mem.c b/arch/arm/cpu/armv7/am33xx/mem.c new file mode 100644 index 000..b8f54ab --- /dev/null +++ b/arch/arm/cpu/armv7/am33xx/mem.c @@ -0,0 +1,101 @@ +/* + * (C) Copyright 2010 + * Texas Instruments, www.ti.com + * + * Author : + * Mansoor Ahamed mansoor.aha...@ti.com + * + * Initial Code from: + * Manikandan Pillai mani.pil...@ti.com + * Richard Woodruff r-woodru...@ti.com + * Syed Mohammed Khasim kha...@ti.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include asm/io.h +#include asm/arch/cpu.h +#include asm/arch/mem.h +#include asm/arch/sys_proto.h +#include command.h + +struct gpmc *gpmc_cfg; + +#if defined(CONFIG_CMD_NAND) +static const u32 gpmc_m_nand[GPMC_MAX_REG] = { + M_NAND_GPMC_CONFIG1, + M_NAND_GPMC_CONFIG2, + M_NAND_GPMC_CONFIG3, + M_NAND_GPMC_CONFIG4, + M_NAND_GPMC_CONFIG5, + M_NAND_GPMC_CONFIG6, 0 +}; +#endif + + +void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base, + u32 size) +{ + writel(0, cs-config7); + sdelay(1000); + /* Delay for settling */ + writel(gpmc_config[0], cs-config1); + writel(gpmc_config[1], cs-config2); + writel(gpmc_config[2], cs-config3); + writel(gpmc_config[3], cs-config4); + writel(gpmc_config[4], cs-config5); + writel(gpmc_config[5], cs-config6); + /* Enable the config */ + writelsize 0xF) 8) | ((base 24) 0x3F) | + (1 6)), cs-config7); + sdelay(2000); +} + +/* + * gpmc_init(): init gpmc bus + * Init GPMC for x16, MuxMode (SDRAM in x32). + * This code can only be executed from SRAM or SDRAM. + */
[U-Boot] [PATCH v2 4/8] am335x_evm: enable NAND support
Enable NAND support for AM335X boards. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v2: - rebased onto master - minor config style fix (wrt nand) board/ti/am335x/board.c |2 ++ include/configs/am335x_evm.h | 12 2 files changed, 14 insertions(+) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b56a801..6908378 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -318,6 +318,8 @@ int board_init(void) gd-bd-bi_boot_params = PHYS_DRAM_1 + 0x100; + gpmc_init(); + return 0; } diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index b6e48f8..ded1cab 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -274,4 +274,16 @@ #define CONFIG_PHYLIB #define CONFIG_PHY_SMSC +#define CONFIG_NAND +/* NAND support */ +#ifdef CONFIG_NAND +#define CONFIG_CMD_NAND +#define CONFIG_NAND_OMAP_GPMC +#define GPMC_NAND_ECC_LP_x16_LAYOUT1 +#define CONFIG_SYS_NAND_BASE (0x0800)/* physical address */ + /* to access nand at */ + /* CS0 */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ +#endif /* devices */ + #endif /* ! __CONFIG_AM335X_EVM_H */ -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 5/8] am33xx: add ELM support
From: Mansoor Ahamed mansoor.aha...@ti.com AM33XX has Error Location Module (ELM) that can be used in conjuction with GPMC controller to implement BCH codes fully in hardware. This code is mostly taken from arago tree. Signed-off-by: Mansoor Ahamed mansoor.aha...@ti.com Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v2: - fix wrong braces in Makefile arch/arm/cpu/armv7/am33xx/Makefile |1 + arch/arm/cpu/armv7/am33xx/clock.c |5 + arch/arm/cpu/armv7/am33xx/elm.c| 212 arch/arm/include/asm/arch-am33xx/elm.h | 93 ++ 4 files changed, 311 insertions(+) create mode 100644 arch/arm/cpu/armv7/am33xx/elm.c create mode 100644 arch/arm/include/asm/arch-am33xx/elm.h diff --git a/arch/arm/cpu/armv7/am33xx/Makefile b/arch/arm/cpu/armv7/am33xx/Makefile index f565357..70c443e 100644 --- a/arch/arm/cpu/armv7/am33xx/Makefile +++ b/arch/arm/cpu/armv7/am33xx/Makefile @@ -23,6 +23,7 @@ COBJS += ddr.o COBJS += emif4.o COBJS += board.o COBJS += mux.o +COBJS-$(CONFIG_NAND_OMAP_GPMC) += elm.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/am33xx/clock.c b/arch/arm/cpu/armv7/am33xx/clock.c index 6eb7d9f..2b7c910 100644 --- a/arch/arm/cpu/armv7/am33xx/clock.c +++ b/arch/arm/cpu/armv7/am33xx/clock.c @@ -155,6 +155,11 @@ static void enable_per_clocks(void) while (readl(cmper-gpmcclkctrl) != PRCM_MOD_EN) ; + /* ELM */ + writel(PRCM_MOD_EN, cmper-elmclkctrl); + while (readl(cmper-elmclkctrl) != PRCM_MOD_EN) + ; + /* MMC0*/ writel(PRCM_MOD_EN, cmper-mmc0clkctrl); while (readl(cmper-mmc0clkctrl) != PRCM_MOD_EN) diff --git a/arch/arm/cpu/armv7/am33xx/elm.c b/arch/arm/cpu/armv7/am33xx/elm.c new file mode 100644 index 000..9eed23d --- /dev/null +++ b/arch/arm/cpu/armv7/am33xx/elm.c @@ -0,0 +1,212 @@ +/* + * (C) Copyright 2010-2011 Texas Instruments, www.ti.com + * Mansoor Ahamed mansoor.aha...@ti.com + * + * BCH Error Location Module (ELM) support. + * + * NOTE: + * 1. Supports only continuous mode. Dont see need for page mode in uboot + * 2. Supports only syndrome polynomial 0. i.e. poly local variable is + *always set to ELM_DEFAULT_POLY. Dont see need for other polynomial + *sets in uboot + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#include asm/io.h +#include asm/errno.h +#include asm/arch/cpu.h +#include asm/arch/omap_gpmc.h +#include asm/arch/elm.h + +#define ELM_DEFAULT_POLY (0) + +struct elm *elm_cfg; + +/** + * elm_load_syndromes - Load BCH syndromes based on nibble selection + * @syndrome: BCH syndrome + * @nibbles: + * @poly: Syndrome Polynomial set to use + * + * Load BCH syndromes based on nibble selection + */ +static void elm_load_syndromes(u8 *syndrome, u32 nibbles, u8 poly) +{ + u32 *ptr; + u32 val; + + /* reg 0 */ + ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[0]; + val = syndrome[0] | (syndrome[1] 8) | (syndrome[2] 16) | + (syndrome[3] 24); + writel(val, ptr); + /* reg 1 */ + ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[1]; + val = syndrome[4] | (syndrome[5] 8) | (syndrome[6] 16) | + (syndrome[7] 24); + writel(val, ptr); + + /* BCH 8-bit with 26 nibbles (4*8=32) */ + if (nibbles 13) { + /* reg 2 */ + ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[2]; + val = syndrome[8] | (syndrome[9] 8) | (syndrome[10] 16) | + (syndrome[11] 24); + writel(val, ptr); + /* reg 3 */ + ptr = elm_cfg-syndrome_fragments[poly].syndrome_fragment_x[3]; + val = syndrome[12] | (syndrome[13] 8) | + (syndrome[14] 16) | (syndrome[15] 24); + writel(val, ptr); + } + + /* BCH 16-bit with 52 nibbles (7*8=56) */ + if (nibbles 26) { + /* reg 4 */ + ptr =
[U-Boot] [PATCH v2 6/8] omap_gpmc: BCH8 support (ELM based)
From: Mansoor Ahamed mansoor.aha...@ti.com This patch adds support for BCH8 error correction code to omap_gpmc driver. We use GPMC to generate codes/syndromes but we need ELM to find error locations from given syndrome. Signed-off-by: Mansoor Ahamed mansoor.aha...@ti.com [ilya: merge it with omap_gpmc driver, some fixes and cleanup] Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- drivers/mtd/nand/omap_gpmc.c | 403 +- 1 file changed, 402 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index f1469d1..cee394e 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -29,6 +29,9 @@ #include linux/mtd/nand_ecc.h #include linux/compiler.h #include nand.h +#ifdef CONFIG_AM33XX +#include asm/arch/elm.h +#endif static uint8_t cs; static __maybe_unused struct nand_ecclayout hw_nand_oob = @@ -234,6 +237,370 @@ static void __maybe_unused omap_enable_hwecc(struct mtd_info *mtd, int32_t mode) } } +/* + * BCH8 support (needs ELM and thus AM33xx-only) + */ +#ifdef CONFIG_AM33XX +struct nand_bch_priv { + uint8_t mode; + uint8_t type; + uint8_t nibbles; +}; + +/* bch types */ +#define ECC_BCH4 0 +#define ECC_BCH8 1 +#define ECC_BCH16 2 + +/* BCH nibbles for diff bch levels */ +#define NAND_ECC_HW_BCH ((uint8_t)(NAND_ECC_HW_OOB_FIRST) + 1) +#define ECC_BCH4_NIBBLES 13 +#define ECC_BCH8_NIBBLES 26 +#define ECC_BCH16_NIBBLES 52 + +static struct nand_ecclayout hw_bch8_nand_oob = GPMC_NAND_HW_BCH8_ECC_LAYOUT; + +static struct nand_bch_priv bch_priv = { + .mode = NAND_ECC_HW_BCH, + .type = ECC_BCH8, + .nibbles = ECC_BCH8_NIBBLES +}; + +/* + * omap_read_bch8_result - Read BCH result for BCH8 level + * + * @mtd: MTD device structure + * @big_endian:When set read register 3 first + * @ecc_code: Read syndrome from BCH result registers + */ +static void omap_read_bch8_result(struct mtd_info *mtd, uint8_t big_endian, + uint8_t *ecc_code) +{ + uint32_t *ptr; + int8_t i = 0, j; + + if (big_endian) { + ptr = gpmc_cfg-bch_result_0_3[0].bch_result_x[3]; + ecc_code[i++] = readl(ptr) 0xFF; + ptr--; + for (j = 0; j 3; j++) { + ecc_code[i++] = (readl(ptr) 24) 0xFF; + ecc_code[i++] = (readl(ptr) 16) 0xFF; + ecc_code[i++] = (readl(ptr) 8) 0xFF; + ecc_code[i++] = readl(ptr) 0xFF; + ptr--; + } + } else { + ptr = gpmc_cfg-bch_result_0_3[0].bch_result_x[0]; + for (j = 0; j 3; j++) { + ecc_code[i++] = readl(ptr) 0xFF; + ecc_code[i++] = (readl(ptr) 8) 0xFF; + ecc_code[i++] = (readl(ptr) 16) 0xFF; + ecc_code[i++] = (readl(ptr) 24) 0xFF; + ptr++; + } + ecc_code[i++] = readl(ptr) 0xFF; + ecc_code[i++] = 0; /* 14th byte is always zero */ + } +} + +/* + * omap_ecc_disable - Disable H/W ECC calculation + * + * @mtd: MTD device structure + * + */ +static void omap_ecc_disable(struct mtd_info *mtd) +{ + writel((readl(gpmc_cfg-ecc_config) ~0x1), + gpmc_cfg-ecc_config); +} + +/* + * omap_rotate_ecc_bch - Rotate the syndrome bytes + * + * @mtd: MTD device structure + * @calc_ecc: ECC read from ECC registers + * @syndrome: Rotated syndrome will be retuned in this array + * + */ +static void omap_rotate_ecc_bch(struct mtd_info *mtd, uint8_t *calc_ecc, + uint8_t *syndrome) +{ + struct nand_chip *chip = mtd-priv; + struct nand_bch_priv *bch = chip-priv; + uint8_t n_bytes = 0; + int8_t i, j; + + switch (bch-type) { + case ECC_BCH4: + n_bytes = 8; + break; + + case ECC_BCH16: + n_bytes = 28; + break; + + case ECC_BCH8: + default: + n_bytes = 13; + break; + } + + for (i = 0, j = (n_bytes-1); i n_bytes; i++, j--) + syndrome[i] = calc_ecc[j]; +} + +/* + * omap_calculate_ecc_bch - Read BCH ECC result + * + * @mtd: MTD structure + * @dat: unused + * @ecc_code: ecc_code buffer + */ +static int omap_calculate_ecc_bch(struct mtd_info *mtd, const uint8_t *dat, + uint8_t *ecc_code) +{ + struct nand_chip *chip = mtd-priv; + struct nand_bch_priv *bch = chip-priv; + uint8_t big_endian = 1; + int8_t ret = 0; + + if (bch-type == ECC_BCH8) + omap_read_bch8_result(mtd, big_endian, ecc_code); + else /* BCH4 and BCH16 currently not supported */ + ret = -1; + + /* +* Stop reading
[U-Boot] [PATCH v2 8/8] am335x_evm: enable SPL NAND support
Enable booting from NAND support from AM335x boards as well as environment in NAND. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- include/configs/am335x_evm.h | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index ded1cab..6abe544 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -240,6 +240,35 @@ #define CONFIG_SYS_SPI_U_BOOT_SIZE 0x4 #define CONFIG_SPL_LDSCRIPT$(CPUDIR)/omap-common/u-boot-spl.lds +#define CONFIG_SPL_BOARD_INIT +#define CONFIG_SPL_NAND_AM33XX_BCH +#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_SYS_NAND_5_ADDR_CYCLE +#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ +CONFIG_SYS_NAND_PAGE_SIZE) +#define CONFIG_SYS_NAND_PAGE_SIZE 2048 +#define CONFIG_SYS_NAND_OOBSIZE64 +#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS +#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \ +10, 11, 12, 13, 14, 15, 16, 17, \ +18, 19, 20, 21, 22, 23, 24, 25, \ +26, 27, 28, 29, 30, 31, 32, 33, \ +34, 35, 36, 37, 38, 39, 40, 41, \ +42, 43, 44, 45, 46, 47, 48, 49, \ +50, 51, 52, 53, 54, 55, 56, 57, } + +#define CONFIG_SYS_NAND_ECCSIZE512 +#define CONFIG_SYS_NAND_ECCBYTES 14 + +#define CONFIG_SYS_NAND_ECCSTEPS 4 +#defineCONFIG_SYS_NAND_ECCTOTAL(CONFIG_SYS_NAND_ECCBYTES * \ + CONFIG_SYS_NAND_ECCSTEPS) + +#defineCONFIG_SYS_NAND_U_BOOT_STARTCONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_NAND_U_BOOT_OFFS0x8 + /* * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM * 64 bytes before this address should be set aside for u-boot.img's @@ -283,7 +312,12 @@ #define CONFIG_SYS_NAND_BASE (0x0800)/* physical address */ /* to access nand at */ /* CS0 */ -#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ -#endif /* devices */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND + devices */ +#undef CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_OFFSET 0x26 /* environment starts here */ +#define CONFIG_SYS_ENV_SECT_SIZE (128 10) /* 128 KiB */ +#endif #endif /* ! __CONFIG_AM335X_EVM_H */ -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 7/8] am33xx_spl_bch: simple SPL nand loader for AM33XX
AM33XX with BCH8 can't work with nand_spl_simple correctly because custom read_page implementation is required for proper syndrome generation. This simple driver mostly duplicates nand_spl_simple but has nand_read_page changed to suit our needs. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/am335x_spl_bch.c | 238 + 2 files changed, 239 insertions(+) create mode 100644 drivers/mtd/nand/am335x_spl_bch.c diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index beb99ca..5322f3a 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -30,6 +30,7 @@ ifdef CONFIG_SPL_BUILD ifdef CONFIG_SPL_NAND_SIMPLE COBJS-y += nand_spl_simple.o endif +COBJS-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o ifdef CONFIG_SPL_NAND_LOAD COBJS-y+= nand_spl_load.o endif diff --git a/drivers/mtd/nand/am335x_spl_bch.c b/drivers/mtd/nand/am335x_spl_bch.c new file mode 100644 index 000..b84528b --- /dev/null +++ b/drivers/mtd/nand/am335x_spl_bch.c @@ -0,0 +1,238 @@ +/* + * (C) Copyright 2012 + * Konstantin Kozhevnikov, Cogent Embedded + * + * based on nand_spl_simple code + * + * (C) Copyright 2006-2008 + * Stefan Roese, DENX Software Engineering, s...@denx.de. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc. + */ + +#include common.h +#include nand.h +#include asm/io.h +#include linux/mtd/nand_ecc.h + +static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS; +static nand_info_t mtd; +static struct nand_chip nand_chip; + +#define ECCSTEPS (CONFIG_SYS_NAND_PAGE_SIZE / \ + CONFIG_SYS_NAND_ECCSIZE) +#define ECCTOTAL (ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES) + + +/* + * NAND command for large page NAND devices (2k) + */ +static int nand_command(int block, int page, uint32_t offs, + u8 cmd) +{ + struct nand_chip *this = mtd.priv; + int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT; + void (*hwctrl)(struct mtd_info *mtd, int cmd, + unsigned int ctrl) = this-cmd_ctrl; + + while (!this-dev_ready(mtd)) + ; + + /* Emulate NAND_CMD_READOOB */ + if (cmd == NAND_CMD_READOOB) { + offs += CONFIG_SYS_NAND_PAGE_SIZE; + cmd = NAND_CMD_READ0; + } + + /* Begin command latch cycle */ + hwctrl(mtd, cmd, NAND_CTRL_CLE | NAND_CTRL_CHANGE); + + if (cmd == NAND_CMD_RESET) { + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + while (!this-dev_ready(mtd)) + ; + return 0; + } + + /* Shift the offset from byte addressing to word addressing. */ + if (this-options NAND_BUSWIDTH_16) + offs = 1; + + /* Set ALE and clear CLE to start address cycle */ + /* Column address */ + hwctrl(mtd, offs 0xff, + NAND_CTRL_ALE | NAND_CTRL_CHANGE); /* A[7:0] */ + hwctrl(mtd, (offs 8) 0xff, NAND_CTRL_ALE); /* A[11:9] */ + /* Row address */ + hwctrl(mtd, (page_addr 0xff), NAND_CTRL_ALE); /* A[19:12] */ + hwctrl(mtd, ((page_addr 8) 0xff), + NAND_CTRL_ALE); /* A[27:20] */ +#ifdef CONFIG_SYS_NAND_5_ADDR_CYCLE + /* One more address cycle for devices 128MiB */ + hwctrl(mtd, (page_addr 16) 0x0f, + NAND_CTRL_ALE); /* A[31:28] */ +#endif + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + + if (cmd == NAND_CMD_READ0) { + /* Latch in address */ + hwctrl(mtd, NAND_CMD_READSTART, + NAND_CTRL_CLE | NAND_CTRL_CHANGE); + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + + /* +* Wait a while for the data to be ready +*/ + while (!this-dev_ready(mtd)) + ; + } else if (cmd == NAND_CMD_RNDOUT) { + hwctrl(mtd, NAND_CMD_RNDOUTSTART, NAND_CTRL_CLE | + NAND_CTRL_CHANGE); + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + } + + return 0; +} + +static int nand_is_bad_block(int block) +{ + struct nand_chip *this = mtd.priv; + + nand_command(block,
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
On Tue, Nov 06, 2012 at 02:56:37PM -0800, Marek Vasut wrote: Dear Simon Glass, Hi Marek, On Tue, Nov 6, 2012 at 2:49 PM, Marek Vasut ma...@denx.de wrote: Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( Because it's a fair chunk of work Let's either do it properly or not at all ... if I let you do these semi- complete fixes, we'll end up with a stinking pile of crap like windows ... I'm definately on board with changing it over to use input, it seems like the right thing to do. I just wasn't signing up to do the work right now. I'm happy to help review patches though if someone else wants to jump in. -Allen -- nvpublic ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] USB: add arrow key support to usb_kbd
On 11/06/2012 03:56 PM, Marek Vasut wrote: Dear Simon Glass, Hi Marek, On Tue, Nov 6, 2012 at 2:49 PM, Marek Vasut ma...@denx.de wrote: Dear Allen Martin, Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue If it's the real fix, then why not go for the real fix right away? :-( Because it's a fair chunk of work Let's either do it properly or not at all ... if I let you do these semi- complete fixes, we'll end up with a stinking pile of crap like windows ... Marek, I find this attitude a little ridiculous. If everything was fixed completely the first time around, there would be no work left to do; we'd just stop developing U-Boot. Equally, if this small addition to the USB keyboard code is so bad it can't be allowed since the whole driver must be re-written instead, why was the existing code allowed into U-Boot in the first place? Incremental small patches are good; they allow small simple things to be implemented without causing massive disruption. That's great for locating any regressions. Is there anything actually technically wrong with this specific patch? I would say no; it's very simple, non-invasive, low-risk, doesn't appear to introduce any long-term maintenance burden, doesn't completely prevent or remotely hinder reworking the USB keyboard support in the future, etc. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3] common: add ifdefs around bouncebuf.c body
On 11/06/2012 03:57 PM, Marek Vasut wrote: Dear Stephen Warren, On 11/06/2012 03:43 PM, Marek Vasut wrote: Dear Stephen Warren, On 11/05/2012 05:54 PM, Marek Vasut wrote: Dear Stephen Warren, From: Stephen Warren swar...@nvidia.com If a U-Boot config file enables CONFIG_BOUNCE_BUFFER only for the main U-Boot build and not for the SPL, then config.mk will contain CONFIG_BOUNCE_BUFFER=y, so common/Makefile will build bouncebuf.c for both the SPL and main U-Boot, but config.h won't set CONFIG_BOUNCE_BUFFER for the SPL, so bouncebuf.h will provide static inline functions, which will conflict with the compiled bouncebuf.c. Solve this by guarding the body of bouncebuf.c with the ifdef to avoid conflicts. Uh, don't you want the bounce buffer not compiled in for SPL? Then maybe add CONFIG_SPL_BOUNCE_BUFFER to force BB to be compiled into SPL or something ... Not compiling bouncebuf.c for SPL would solve this too. I have no idea what build system contortions would be required to do this though. Do you think the build system should be fixed first rather than taking this series/patch? I guess we shouldn't need a separate CONFIG_SPL_BOUNCE_BUFFER option though; we should rather simply set CONFIG_SPL_BOUNCE_BUFFER appropriately for SPL and non-SPL, and have everything key off that one variable, right? How will you be able to configure it separately for spl and non-spl ? For example, include/configs/trimslice.h contains: /* SD/MMC */ #define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_TEGRA_MMC #define CONFIG_CMD_MMC However, we don't use MMC in our SPL, but don't want to pollute every Tegra board file with ifdefs for SPL, so include/configs/tegra-common-post.h (which is included at the end of trimslice.h) contains: #ifdef CONFIG_SPL_BUILD ... /* remove MMC support */ #ifdef CONFIG_MMC #undef CONFIG_MMC #endif #ifdef CONFIG_GENERIC_MMC #undef CONFIG_GENERIC_MMC #endif #ifdef CONFIG_TEGRA_MMC #undef CONFIG_TEGRA_MMC #endif #ifdef CONFIG_CMD_MMC #undef CONFIG_CMD_MMC #endif ... #endif And in the V1 patch I proposed to tegra-common-post.h, I added the following at the end: #ifdef CONFIG_TEGRA_MMC #define CONFIG_BOUNCE_BUFFER #endif Yet, this doesn't solve the problem with SPL ... since for SPL, you'd have to do ifdef CONFIG_SPL, no? Sorry, what problem with the SPL is this not solving? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [Drivers PATCH 17/19] imls: Add support to list images in NAND device
On 11/02/2012 12:40:02 PM, Vipin Kumar wrote: imls does not list the images in NAND devices. This patch implements this support for legacy type images. Signed-off-by: Vipin Kumar vipin.ku...@st.com --- common/cmd_bootm.c | 98 ++ 1 file changed, 98 insertions(+) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 83fa5d7..ca3c430 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -62,6 +62,11 @@ #include linux/lzo.h #endif /* CONFIG_LZO */ +#if defined(CONFIG_CMD_NAND) +#include linux/err.h +#include nand.h +#endif You shouldn't need to ifdef-protect header files. DECLARE_GLOBAL_DATA_PTR; #ifndef CONFIG_SYS_BOOTM_LEN @@ -1221,6 +1226,99 @@ next_sector: ; next_bank: ; } +#if defined(CONFIG_CMD_NAND) + printf(\n); + nand_info_t *nand; + image_header_t image_header; + image_header_t *header = image_header; + int nand_dev = nand_curr_device; + unsigned long img_size; + size_t hdr_size, read_len; + loff_t off; + unsigned int crc; + u_char *data; + + /* the following commands operate on the current device */ + if (nand_dev 0 || nand_dev = CONFIG_SYS_MAX_NAND_DEVICE) { + puts(\nNo NAND devices available\n); + return 0; + } Please move the NAND and NOR code into their own functions. + + for (nand_dev = 0; nand_dev CONFIG_SYS_MAX_NAND_DEVICE; nand_dev++) { + + nand = nand_info[nand_dev]; + if ((!nand-name) || (!nand-size)) + continue; Redundant parentheses. + data = malloc(nand-writesize); + if (!data) { + puts(No memory available to list NAND images\n); + return 0; + } + + for (off = 0; off nand-size; off += nand-erasesize) { + int ret; + + if (nand_block_isbad(nand, off)) + continue; + + hdr_size = sizeof(image_header_t); + ret = nand_read(nand, off, hdr_size, (u_char *)header); + if (ret 0 ret != -EUCLEAN) + continue; I guess you don't use nand_read_skip_bad() because you don't want to allocate a buffer for the whole image... How about moving this code to nand_util.c? That would at least allow some refactoring rather than duplication. + if (!image_check_hcrc(header)) + continue; + + printf(Legacy Image at NAND device %d offset %08lX:\n, + nand_dev, (ulong)off); + image_print_contents(header); Shouldn't you check for FIT images as well? + puts( Verifying Checksum ... ); + crc = 0; + img_size = ntohl(header-ih_size); + img_size += hdr_size; + + while (img_size 0) { + int blockoff = 0; + + while (nand_block_isbad(nand, off)) { + off += nand-erasesize; + if (off = nand-size) + goto out; + } + + do { + read_len = min(img_size, + nand-writesize); + ret = nand_read(nand, off + blockoff, + read_len, data); + if (ret 0 ret != -EUCLEAN) + break; + + crc = crc32(crc, data + hdr_size, + read_len - hdr_size); + img_size -= read_len; + blockoff += read_len; + hdr_size = 0; + } while (img_size + (blockoff nand-erasesize)); + + off += nand-erasesize; + if (off = nand-size) + goto out; + } + off -= nand-erasesize; +out: + if (crc != ntohl(header-ih_dcrc)) + puts( Bad Data CRC\n); + else + puts(OK\n); + } Please refactor this into separate functions to improve readability. Maybe put a nand_crc_skip_bad() function into nand_util.c? -Scott ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] ubi: Only read the actual size of the VID header
Hi Stefan, On Tue, Nov 6, 2012 at 2:19 AM, Stefan Roese s...@denx.de wrote: On 11/05/2012 05:46 PM, Joe Hershberger wrote: If sub-page reads are supported, this will save reading unneeded data Signed-off-by: Joe Hershberger joe.hershber...@ni.com --- drivers/mtd/ubi/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 8423894..23660e3 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -916,7 +916,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, p = (char *)vid_hdr - ubi-vid_hdr_shift; err = ubi_io_read(ubi, p, pnum, ubi-vid_hdr_aloffset, - ubi-vid_hdr_alsize); + UBI_VID_HDR_SIZE); if (err) { if (err != UBI_IO_BITFLIPS err != -EBADMSG) return err; Joe, are you pushing this change to Linux as well? I would really like to see Artem commenting on this. Yes. We will post this to Linux as well. -Joe ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/5 v2] Add DT based ethernet driver for SMDK5250
Hi Katin, On Tue, Nov 6, 2012 at 2:13 AM, Hatim Ali hatim...@samsung.com wrote: This patch series enables the DT support on SMDK5250. Ethernet is the first driver whose discovery is based on DT node. More DT based drivers to be added subsequently Changes since v1: - Renamed the smdk5250.h file to exynos5250-dt.h to create a common configuration file which can be used by all the boards based on exynos5250 using Device Tree. - Created a new smdk5250.h file specifying the dts file specific to SMDK5250 - Incorporated minor nit (removal of blank lines) I went through this series again, and it looks good to me. The series: Acked-by: Simon Glass s...@chromium.org Hatim Ali (5): EXYNOS5: FDT: add initial dts file for EXYNOS5250, SMDK5250 fdt: exynos5: Add DT node definition for SROM and SMSC9215 exynos5: Add DT based driver for SMC911X ethernet exynos5: config: Rename the smdk5250.h to exynos5250-dt.h SMDK5250: config: Add configuration file for SMDK5250 board arch/arm/dts/exynos5250.dtsi | 31 arch/arm/include/asm/arch-exynos/sromc.h | 18 ++ board/samsung/dts/exynos5250-smdk5250.dts | 29 +++ board/samsung/smdk5250/smdk5250.c | 115 + include/configs/exynos5250-dt.h | 267 + include/configs/smdk5250.h| 245 +- include/fdtdec.h |2 + lib/fdtdec.c |2 + 8 files changed, 442 insertions(+), 267 deletions(-) create mode 100644 arch/arm/dts/exynos5250.dtsi create mode 100644 board/samsung/dts/exynos5250-smdk5250.dts create mode 100644 include/configs/exynos5250-dt.h -- 1.7.2.3 Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 0/13] Port of MUSB driver from Linux (changes from Linux)
Current MUSB driver in U-Boot uses old UDC API while new gagdet client drivers need new gadget API. Also current MUSB driver has some significant limitations (like inability to handle tx for endpoints other than ep0). So I think port of new Linux driver is desirable. This is initial port, performed mostly by putting DM and OTG code under #ifndef __UBOOT__ clauses. My intention was to be as close as possible to the original to ease of possible resyncs. Some warnings are suppressed via CFLAGS. There are some style problems but I'm not touching them for now for the above mentioned reason. There is obviously some room for optimisation, some structure fields are unused as well as (probably) some code. This is not a replacement for existing MUSB driver (at least for now), cause there are still consumers of USB serial gadget which uses old API and there is no support for serial with new API for now. OTG and DMA are not supported. Ported drivers include: musb_dsps (should work both with TI AM33xx and TI81xx, tested only on AM33xx), am35x (tested on AM3517 EVM) and omap2plus (should work on OMAP2/3/4, tested on omap3_beagle, omap4_panda doesn't work and needs more work). Others should be easy to port too. Virtual root hub is not implemented but this shouldn't be a big problem as the old code has virtual root hub support enabled only for Blackfin platform. Pathes are rather big because of the original code size (and I didn't delete unused code, just disabled it). So it's probably better to look at changes as compared to Linux code. I prepared such version also, you can find it at [1]. Hopefully it will be also useful if resync with the kernel will be needed in future. [1] https://github.com/yanok/u-boot/tree/musb-changes-from-linux-v4 Changes in v5: - rebase, compile fix (use usb_config_descriptor) - linux-compat: remove __releases and __aquires - rebase onto master (board_eth_init moved to board/) - rebase onto master (board_eth_init moved to board/) - don't init usb ether in SPL Changes in v4: - fix indent - minor style fixes Changes in v3: - fix old MUSB code compilation - bugfix: struct musb should be zeroed after alloc - fix musb gadget_chips entry - fix for new multi-interface usb API - use clrsetbits_le32 for USB PHY ops Changes in v2: - add missing linux-compat.h header - added host support - glue code moved from musb_gadget_uboot.c to musb_uboot.c and cleaned up slightly. - added check for malloc return value - define is_{host,peripheral}_capable conditionally to support compilation with only host or gadget enabled - added some more is_{host,peripheral}_capable guards to core code to support compilation with only host or gadget enabled - rename backend config option to CONFIG_USB_MUSB_DSPS - we are providing host support now so add yourself to usb.h Ilya Yanok (13): linux/usb/ch9.h: update with the version from Linux tree usb: use linux/usb/ch9.h instead of usbdescriptors.h musb-new: port of Linux musb driver musb-new: dsps backend driver am33xx: init OTG hardware and new musb gadget driver am335x_evm: enable both musb gadget and host musb-new: am35x backend driver OMAP3: am35x_def.h: add USB defines OMAP3: am35x: add musb functions am3517_evm: switch to musb-new musb-new: omap2plus backend driver omap3_beagle: add musb-new init omap3_beagle: use new MUSB intstead of the old one Makefile |1 + arch/arm/cpu/armv7/am33xx/board.c | 85 + arch/arm/cpu/armv7/am33xx/clock.c |8 + arch/arm/cpu/armv7/omap3/Makefile |1 + arch/arm/cpu/armv7/omap3/am35x_musb.c | 75 + arch/arm/include/asm/arch-am33xx/cpu.h| 11 +- arch/arm/include/asm/arch-am33xx/hardware.h |4 + arch/arm/include/asm/arch-omap3/am35x_def.h | 27 + arch/arm/include/asm/arch-omap3/musb.h| 28 + arch/arm/include/asm/omap_musb.h | 32 + arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +- arch/powerpc/cpu/mpc5xxx/usb_ohci.c |2 +- arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +- board/logicpd/am3517evm/am3517evm.c | 74 + board/ti/am335x/board.c | 23 +- board/ti/beagle/beagle.c | 43 + common/cmd_usb.c |2 +- common/usb.c |4 +- drivers/usb/gadget/config.c |1 - drivers/usb/gadget/epautoconf.c |1 - drivers/usb/gadget/ether.c|1 - drivers/usb/gadget/gadget_chips.h |4 +- drivers/usb/gadget/s3c_udc_otg.c |1 - drivers/usb/gadget/usbstring.c|1 - drivers/usb/host/ehci-hcd.c | 16 +- drivers/usb/host/isp116x-hcd.c|2 +- drivers/usb/host/ohci-hcd.c |2 +- drivers/usb/host/ohci-s3c24xx.c |2 +-
[U-Boot] [PATCH v5 02/13] usb: use linux/usb/ch9.h instead of usbdescriptors.h
Linux usb/ch9.h seems to have all the same information (and more) as usbdescriptors.h so use the former instead of the later one. As a consequense of this change USB_SPEED_* values don't correspond directly to EHCI speed encoding anymore, I've added necessary recoding in EHCI driver. Also there is no point to put speed into pipe anymore so it's removed and a bunch of host drivers fixed to look at usb_device-speed instead. Old usbdescriptors.h included is not removed as it seems to be used by old USB device code. This makes usb.h and usbdevice.h incompatible. Fortunately the only place that tries to include both are the old MUSB code and it needs usb.h only for USB_DMA_MINALIGN used in aligned attribute on musb_regs structure but this attribute seems to be unneeded (old MUSB code doesn't support any DMA at all). Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v5: - rebase, compile fix (use usb_config_descriptor) Changes in v4: - fix indent Changes in v3: - fix old MUSB code compilation arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c |2 +- arch/powerpc/cpu/mpc5xxx/usb_ohci.c |2 +- arch/powerpc/cpu/ppc4xx/usb_ohci.c|2 +- common/cmd_usb.c |2 +- common/usb.c |4 ++-- drivers/usb/host/ehci-hcd.c | 16 ++-- drivers/usb/host/isp116x-hcd.c|2 +- drivers/usb/host/ohci-hcd.c |2 +- drivers/usb/host/ohci-s3c24xx.c |2 +- drivers/usb/host/sl811-hcd.c |2 +- drivers/usb/musb/musb_core.h |3 +-- drivers/usb/musb/musb_hcd.c |5 +++-- include/usb.h | 15 +++ include/usb_defs.h|6 -- 14 files changed, 31 insertions(+), 34 deletions(-) diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c index c747767..b9b0998 100644 --- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c +++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c @@ -615,7 +615,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe) | usb_pipeendpoint (pipe) 7 | (usb_pipeisoc (pipe)? 0x8000: 0) | (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 0x800: 0x1000)) - | usb_pipeslow (pipe) 13 + | (usb_dev-speed == USB_SPEED_LOW) 13 | usb_maxpacket (usb_dev, pipe) 16); return ed_ret; diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c index 607034b..de07343 100644 --- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c +++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c @@ -618,7 +618,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe) | usb_pipeendpoint (pipe) 7 | (usb_pipeisoc (pipe)? 0x8000: 0) | (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 0x800: 0x1000)) - | usb_pipeslow (pipe) 13 + | (usb_dev-speed == USB_SPEED_LOW) 13 | usb_maxpacket (usb_dev, pipe) 16); return ed_ret; diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c index 4ce2726..f820c37 100644 --- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c +++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c @@ -621,7 +621,7 @@ static ed_t * ep_add_ed (struct usb_device *usb_dev, unsigned long pipe) | usb_pipeendpoint (pipe) 7 | (usb_pipeisoc (pipe)? 0x8000: 0) | (usb_pipecontrol (pipe)? 0: (usb_pipeout (pipe)? 0x800: 0x1000)) - | usb_pipeslow (pipe) 13 + | (usb_dev-speed == USB_SPEED_LOW) 13 | usb_maxpacket (usb_dev, pipe) 16); return ed_ret; diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 8ad0b23..dacdc2d 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -192,7 +192,7 @@ static void usb_display_desc(struct usb_device *dev) } -static void usb_display_conf_desc(struct usb_configuration_descriptor *config, +static void usb_display_conf_desc(struct usb_config_descriptor *config, struct usb_device *dev) { printf( Configuration: %d\n, config-bConfigurationValue); diff --git a/common/usb.c b/common/usb.c index 50b8175..ac9b4ca 100644 --- a/common/usb.c +++ b/common/usb.c @@ -492,9 +492,9 @@ int usb_get_configuration_no(struct usb_device *dev, { int result; unsigned int tmp; - struct usb_configuration_descriptor *config; + struct usb_config_descriptor *config; - config = (struct usb_configuration_descriptor *)buffer[0]; + config = (struct usb_config_descriptor
[U-Boot] [PATCH v5 01/13] linux/usb/ch9.h: update with the version from Linux tree
Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- drivers/usb/gadget/config.c |1 - drivers/usb/gadget/epautoconf.c |1 - drivers/usb/gadget/ether.c |1 - drivers/usb/gadget/s3c_udc_otg.c |1 - drivers/usb/gadget/usbstring.c |1 - include/linux/usb/ch9.h | 514 -- include/usb/s3c_udc.h|1 - 7 files changed, 499 insertions(+), 21 deletions(-) diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index f88d0c1..f9163a8 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c @@ -27,7 +27,6 @@ #include linux/string.h #include linux/usb/ch9.h -#include usbdescriptors.h #include linux/usb/gadget.h diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index b656c8b..5b8776e 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -23,7 +23,6 @@ #include common.h #include linux/usb/ch9.h -#include usbdescriptors.h #include asm/errno.h #include linux/usb/gadget.h #include asm/unaligned.h diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8b24e00..de880ff 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -24,7 +24,6 @@ #include asm/errno.h #include linux/netdevice.h #include linux/usb/ch9.h -#include usbdescriptors.h #include linux/usb/cdc.h #include linux/usb/gadget.h #include net.h diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c index 3fdfdf7..f9d24e3 100644 --- a/drivers/usb/gadget/s3c_udc_otg.c +++ b/drivers/usb/gadget/s3c_udc_otg.c @@ -37,7 +37,6 @@ #include malloc.h #include linux/usb/ch9.h -#include usbdescriptors.h #include linux/usb/gadget.h #include asm/byteorder.h diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 4dbe060..9cf 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -13,7 +13,6 @@ #include common.h #include asm/errno.h #include linux/usb/ch9.h -#include usbdescriptors.h #include linux/usb/gadget.h #include asm/unaligned.h diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index ce1d1e1..d1d732c 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -28,15 +28,13 @@ * [c] for consistency, removing all doubt even when it appears to * someone that the two other points are non-issues for that * particular descriptor type. - * - * Ported to U-boot by: Thomas Smits ts.sm...@gmail.com and - * Remy Bohmer li...@bohmer.net */ #ifndef __LINUX_USB_CH9_H #define __LINUX_USB_CH9_H #include linux/types.h /* __u8 etc */ +#include asm/byteorder.h /* le16_to_cpu */ /*-*/ @@ -70,7 +68,7 @@ #define USB_RECIP_OTHER0x03 /* From Wireless USB 1.0 */ #define USB_RECIP_PORT 0x04 -#define USB_RECIP_RPIPE0x05 +#define USB_RECIP_RPIPE0x05 /* * Standard requests, for the bRequest field of a SETUP packet. @@ -90,6 +88,8 @@ #define USB_REQ_GET_INTERFACE 0x0A #define USB_REQ_SET_INTERFACE 0x0B #define USB_REQ_SYNCH_FRAME0x0C +#define USB_REQ_SET_SEL0x30 +#define USB_REQ_SET_ISOCH_DELAY0x31 #define USB_REQ_SET_ENCRYPTION 0x0D/* Wireless USB */ #define USB_REQ_GET_ENCRYPTION 0x0E @@ -105,10 +105,16 @@ #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 +/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command, + * used by hubs to put ports into a new L1 suspend state, except that it + * forgot to define its number ... + */ + /* * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and * are read as a bit array returned by USB_REQ_GET_STATUS. (So there - * are at most sixteen features of each type.) + * are at most sixteen features of each type.) Hubs may also support a + * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend. */ #define USB_DEVICE_SELF_POWERED0 /* (read only) */ #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ @@ -120,8 +126,38 @@ #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ +/* + * Test Mode Selectors + * See USB 2.0 spec Table 9-7 + */ +#defineTEST_J 1 +#defineTEST_K 2 +#defineTEST_SE0_NAK3 +#defineTEST_PACKET 4 +#defineTEST_FORCE_EN 5 + +/* + * New Feature Selectors as added by USB 3.0 + * See USB 3.0 spec Table 9-6 + */ +#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */ +#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
[U-Boot] [PATCH v5 04/13] musb-new: dsps backend driver
Backend driver for MUSB OTG controllers found on TI AM33xx and TI81xx SoCs (tested with AM33xx only). Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v2: - rename backend config option to CONFIG_USB_MUSB_DSPS - we are providing host support now so add yourself to usb.h arch/arm/include/asm/omap_musb.h | 25 ++ drivers/usb/musb-new/Makefile|1 + drivers/usb/musb-new/musb_dsps.c | 771 ++ include/usb.h|3 +- 4 files changed, 799 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/omap_musb.h create mode 100644 drivers/usb/musb-new/musb_dsps.c diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h new file mode 100644 index 000..0081a68 --- /dev/null +++ b/arch/arm/include/asm/omap_musb.h @@ -0,0 +1,25 @@ +/* + * Board data structure for musb gadget on OMAPs + * + * Copyright (C) 2012, Ilya Yanok ilya.ya...@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __ASM_ARM_OMAP_MUSB_H +#define __ASM_ARM_OMAP_MUSB_H + +extern struct musb_platform_ops musb_dsps_ops; + +struct omap_musb_board_data { + void (*set_phy_power)(u8 on); +}; +#endif /* __ASM_ARM_OMAP_MUSB_H */ diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile index f01fb16..a753423 100644 --- a/drivers/usb/musb-new/Makefile +++ b/drivers/usb/musb-new/Makefile @@ -9,6 +9,7 @@ LIB := $(obj)libusb_musb-new.o COBJS-$(CONFIG_MUSB_GADGET) += musb_gadget.o musb_gadget_ep0.o musb_core.o COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o +COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \ $(call cc-option,-Wno-unused-but-set-variable) \ diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c new file mode 100644 index 000..9a03917 --- /dev/null +++ b/drivers/usb/musb-new/musb_dsps.c @@ -0,0 +1,771 @@ +/* + * Texas Instruments DSPS platforms glue layer + * + * Copyright (C) 2012, by Texas Instruments + * + * Based on the am35x glue layer code. + * + * This file is part of the Inventra Controller Driver for Linux. + * + * The Inventra Controller Driver for Linux is free software; you + * can redistribute it and/or modify it under the terms of the GNU + * General Public License version 2 as published by the Free Software + * Foundation. + * + * The Inventra Controller Driver for Linux is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Inventra Controller Driver for Linux ; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + * musb_dsps.c will be a common file for all the TI DSPS platforms + * such as dm64x, dm36x, dm35x, da8x, am35x and ti81x. + * For now only ti81x is using this and in future davinci.c, am35x.c + * da8xx.c would be merged to this file after testing. + */ + +#define __UBOOT__ +#ifndef __UBOOT__ +#include linux/init.h +#include linux/io.h +#include linux/err.h +#include linux/platform_device.h +#include linux/dma-mapping.h +#include linux/pm_runtime.h +#include linux/module.h + +#include linux/of.h +#include linux/of_device.h +#include linux/of_address.h + +#include plat/usb.h +#else +#include common.h +#include asm/omap_musb.h +#include linux-compat.h +#endif + +#include musb_core.h + +/** + * avoid using musb_readx()/musb_writex() as glue layer should not be + * dependent on musb core layer symbols. + */ +static inline u8 dsps_readb(const void __iomem *addr, unsigned offset) + { return __raw_readb(addr + offset); } + +static inline u32 dsps_readl(const void __iomem *addr, unsigned offset) + { return __raw_readl(addr + offset); } + +static inline void dsps_writeb(void __iomem *addr, unsigned offset, u8 data) + { __raw_writeb(data, addr + offset); } + +static inline void dsps_writel(void __iomem *addr, unsigned offset, u32 data) + { __raw_writel(data, addr + offset); } + +/** + * DSPS musb wrapper register offset. + * FIXME: This should be expanded to have all the wrapper registers from TI DSPS + * musb ips. + */ +struct dsps_musb_wrapper { + u16
[U-Boot] [PATCH v5 05/13] am33xx: init OTG hardware and new musb gadget driver
AM33xx has support for dual port MUSB OTG controller. This patch adds initialization for the controller using new MUSB gadget driver and ether gadget. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v5: - rebase onto master (board_eth_init moved to board/) Changes in v3: - use clrsetbits_le32 for USB PHY ops arch/arm/cpu/armv7/am33xx/board.c | 85 +++ arch/arm/cpu/armv7/am33xx/clock.c |8 +++ arch/arm/include/asm/arch-am33xx/cpu.h | 11 +++- arch/arm/include/asm/arch-am33xx/hardware.h |4 ++ 4 files changed, 105 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index e4c123c..da5bc73 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -33,6 +33,11 @@ #include i2c.h #include miiphy.h #include cpsw.h +#include asm/errno.h +#include linux/usb/ch9.h +#include linux/usb/gadget.h +#include linux/usb/musb.h +#include asm/omap_musb.h DECLARE_GLOBAL_DATA_PTR; @@ -63,3 +68,83 @@ void setup_clocks_for_console(void) /* Not yet implemented */ return; } + +/* AM33XX has two MUSB controllers which can be host or gadget */ +#if (defined(CONFIG_MUSB_GADGET) || defined(CONFIG_MUSB_HOST)) \ + (defined(CONFIG_AM335X_USB0) || defined(CONFIG_AM335X_USB1)) +static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; + +/* USB 2.0 PHY Control */ +#define CM_PHY_PWRDN (1 0) +#define CM_PHY_OTG_PWRDN (1 1) +#define OTGVDET_EN (1 19) +#define OTGSESSENDEN (1 20) + +static void am33xx_usb_set_phy_power(u8 on, u32 *reg_addr) +{ + if (on) { + clrsetbits_le32(reg_addr, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN, + OTGVDET_EN | OTGSESSENDEN); + } else { + clrsetbits_le32(reg_addr, 0, CM_PHY_PWRDN | CM_PHY_OTG_PWRDN); + } +} + +static struct musb_hdrc_config musb_config = { + .multipoint = 1, + .dyn_fifo = 1, + .num_eps= 16, + .ram_bits = 12, +}; + +#ifdef CONFIG_AM335X_USB0 +static void am33xx_otg0_set_phy_power(u8 on) +{ + am33xx_usb_set_phy_power(on, cdev-usb_ctrl0); +} + +struct omap_musb_board_data otg0_board_data = { + .set_phy_power = am33xx_otg0_set_phy_power, +}; + +static struct musb_hdrc_platform_data otg0_plat = { + .mode = CONFIG_AM335X_USB0_MODE, + .config = musb_config, + .power = 50, + .platform_ops = musb_dsps_ops, + .board_data = otg0_board_data, +}; +#endif + +#ifdef CONFIG_AM335X_USB1 +static void am33xx_otg1_set_phy_power(u8 on) +{ + am33xx_usb_set_phy_power(on, cdev-usb_ctrl1); +} + +struct omap_musb_board_data otg1_board_data = { + .set_phy_power = am33xx_otg1_set_phy_power, +}; + +static struct musb_hdrc_platform_data otg1_plat = { + .mode = CONFIG_AM335X_USB1_MODE, + .config = musb_config, + .power = 50, + .platform_ops = musb_dsps_ops, + .board_data = otg1_board_data, +}; +#endif +#endif + +int arch_misc_init(void) +{ +#ifdef CONFIG_AM335X_USB0 + musb_register(otg0_plat, otg0_board_data, + (void *)AM335X_USB0_OTG_BASE); +#endif +#ifdef CONFIG_AM335X_USB1 + musb_register(otg1_plat, otg1_board_data, + (void *)AM335X_USB1_OTG_BASE); +#endif + return 0; +} diff --git a/arch/arm/cpu/armv7/am33xx/clock.c b/arch/arm/cpu/armv7/am33xx/clock.c index bc2abb6..0b4cb4e 100644 --- a/arch/arm/cpu/armv7/am33xx/clock.c +++ b/arch/arm/cpu/armv7/am33xx/clock.c @@ -40,6 +40,7 @@ #define CLK_MODE_MASK 0xfff8 #define CLK_DIV_SEL0xFFE0 #define CPGMAC0_IDLE 0x3 +#define DPLL_CLKDCOLDO_GATE_CTRL0x300 const struct cm_perpll *cmper = (struct cm_perpll *)CM_PER; const struct cm_wkuppll *cmwkup = (struct cm_wkuppll *)CM_WKUP; @@ -194,6 +195,11 @@ static void enable_per_clocks(void) writel(PRCM_MOD_EN, cmrtc-rtcclkctrl); while (readl(cmrtc-rtcclkctrl) != PRCM_MOD_EN) ; + + /* MUSB */ + writel(PRCM_MOD_EN, cmper-usb0clkctrl); + while (readl(cmper-usb0clkctrl) != PRCM_MOD_EN) + ; } static void mpu_pll_config(void) @@ -290,6 +296,8 @@ static void per_pll_config(void) while (readl(cmwkup-idlestdpllper) != ST_DPLL_CLK) ; + + writel(DPLL_CLKDCOLDO_GATE_CTRL, cmwkup-clkdcoldodpllper); } void ddr_pll_config(unsigned int ddrpll_m) diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h index 819fd2f..d6c038e 100644 --- a/arch/arm/include/asm/arch-am33xx/cpu.h +++ b/arch/arm/include/asm/arch-am33xx/cpu.h @@ -82,7 +82,8 @@ struct cm_wkuppll { unsigned int clkseldpllcore;/* offset 0x68 */ unsigned int resv9[1]; unsigned int
[U-Boot] [PATCH v5 07/13] musb-new: am35x backend driver
Backend driver for MUSB OTG controllers found on TI AM35x. It seems that on AM35X interrupt status registers can be updated _before_ core registers. As we don't use true interrupts in U-Boot and poll interrupt status registers instead this can result in interrupt handler being called with non-updated core registers. This confuses the code and result in hanged transfers. Add a small delay in am35x_interrupt as a workaround. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- arch/arm/include/asm/omap_musb.h|3 + drivers/usb/musb-new/Makefile |1 + drivers/usb/musb-new/am35x.c| 709 +++ drivers/usb/musb-new/linux-compat.h |1 + include/usb.h |2 +- 5 files changed, 715 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/musb-new/am35x.c diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h index 0081a68..46c8578 100644 --- a/arch/arm/include/asm/omap_musb.h +++ b/arch/arm/include/asm/omap_musb.h @@ -18,8 +18,11 @@ #define __ASM_ARM_OMAP_MUSB_H extern struct musb_platform_ops musb_dsps_ops; +extern const struct musb_platform_ops am35x_ops; struct omap_musb_board_data { void (*set_phy_power)(u8 on); + void (*clear_irq)(void); + void (*reset)(void); }; #endif /* __ASM_ARM_OMAP_MUSB_H */ diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile index a753423..23fc735 100644 --- a/drivers/usb/musb-new/Makefile +++ b/drivers/usb/musb-new/Makefile @@ -10,6 +10,7 @@ COBJS-$(CONFIG_MUSB_GADGET) += musb_gadget.o musb_gadget_ep0.o musb_core.o COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o +COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x.o CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \ $(call cc-option,-Wno-unused-but-set-variable) \ diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c new file mode 100644 index 000..57c9bd3 --- /dev/null +++ b/drivers/usb/musb-new/am35x.c @@ -0,0 +1,709 @@ +/* + * Texas Instruments AM35x glue layer + * + * Copyright (c) 2010, by Texas Instruments + * + * Based on the DA8xx glue layer code. + * Copyright (c) 2008-2009, MontaVista Software, Inc. sou...@mvista.com + * + * This file is part of the Inventra Controller Driver for Linux. + * + * The Inventra Controller Driver for Linux is free software; you + * can redistribute it and/or modify it under the terms of the GNU + * General Public License version 2 as published by the Free Software + * Foundation. + * + * The Inventra Controller Driver for Linux is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Inventra Controller Driver for Linux ; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define __UBOOT__ +#ifndef __UBOOT__ +#include linux/init.h +#include linux/module.h +#include linux/clk.h +#include linux/err.h +#include linux/io.h +#include linux/platform_device.h +#include linux/dma-mapping.h + +#include plat/usb.h +#else +#include common.h +#include asm/omap_musb.h +#include linux-compat.h +#endif + +#include musb_core.h + +/* + * AM35x specific definitions + */ +/* USB 2.0 OTG module registers */ +#define USB_REVISION_REG 0x00 +#define USB_CTRL_REG 0x04 +#define USB_STAT_REG 0x08 +#define USB_EMULATION_REG 0x0c +/* 0x10 Reserved */ +#define USB_AUTOREQ_REG0x14 +#define USB_SRP_FIX_TIME_REG 0x18 +#define USB_TEARDOWN_REG 0x1c +#define EP_INTR_SRC_REG0x20 +#define EP_INTR_SRC_SET_REG0x24 +#define EP_INTR_SRC_CLEAR_REG 0x28 +#define EP_INTR_MASK_REG 0x2c +#define EP_INTR_MASK_SET_REG 0x30 +#define EP_INTR_MASK_CLEAR_REG 0x34 +#define EP_INTR_SRC_MASKED_REG 0x38 +#define CORE_INTR_SRC_REG 0x40 +#define CORE_INTR_SRC_SET_REG 0x44 +#define CORE_INTR_SRC_CLEAR_REG0x48 +#define CORE_INTR_MASK_REG 0x4c +#define CORE_INTR_MASK_SET_REG 0x50 +#define CORE_INTR_MASK_CLEAR_REG 0x54 +#define CORE_INTR_SRC_MASKED_REG 0x58 +/* 0x5c Reserved */ +#define USB_END_OF_INTR_REG0x60 + +/* Control register bits */ +#define AM35X_SOFT_RESET_MASK 1 + +/* USB interrupt register bits */ +#define AM35X_INTR_USB_SHIFT 16 +#define AM35X_INTR_USB_MASK(0x1ff AM35X_INTR_USB_SHIFT) +#define AM35X_INTR_DRVVBUS 0x100 +#define AM35X_INTR_RX_SHIFT16 +#define AM35X_INTR_TX_SHIFT0 +#define AM35X_TX_EP_MASK 0x /* EP0 + 15 Tx EPs */ +#define AM35X_RX_EP_MASK 0xfffe /* 15 Rx EPs */ +#define AM35X_TX_INTR_MASK
[U-Boot] [PATCH v5 06/13] am335x_evm: enable both musb gadget and host
Enable musb gadget in Ethernet mode on port 0 and musb host on port1. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- Changes in v5: - rebase onto master (board_eth_init moved to board/) - don't init usb ether in SPL board/ti/am335x/board.c | 23 +-- include/configs/am335x_evm.h | 27 +++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b56a801..f0eca54 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -379,9 +379,14 @@ static struct cpsw_platform_data cpsw_data = { .host_port_num = 0, .version= CPSW_CTRL_VERSION_2, }; +#endif +#if defined(CONFIG_DRIVER_TI_CPSW) || \ + (defined(CONFIG_USB_ETHER) defined(CONFIG_MUSB_GADGET)) int board_eth_init(bd_t *bis) { + int rv, n = 0; +#ifdef CONFIG_DRIVER_TI_CPSW uint8_t mac_addr[6]; uint32_t mac_hi, mac_lo; @@ -400,7 +405,7 @@ int board_eth_init(bd_t *bis) if (is_valid_ether_addr(mac_addr)) eth_setenv_enetaddr(ethaddr, mac_addr); else - return -1; + goto try_usbether; } if (board_is_bone() || board_is_bone_lt() || board_is_idk()) { @@ -413,6 +418,20 @@ int board_eth_init(bd_t *bis) PHY_INTERFACE_MODE_RGMII; } - return cpsw_register(cpsw_data); + rv = cpsw_register(cpsw_data); + if (rv 0) + printf(Error %d registering CPSW switch\n, rv); + else + n += rv; +#endif +try_usbether: +#if defined(CONFIG_USB_ETHER) !defined(CONFIG_SPL_BUILD) + rv = usb_eth_initialize(bis); + if (rv 0) + printf(Error %d registering USB_ETHER\n, rv); + else + n += rv; +#endif + return n; } #endif diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index b6e48f8..ab9549b 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -257,6 +257,33 @@ #define CONFIG_SKIP_LOWLEVEL_INIT #endif +/* + * USB configuration + */ +#define CONFIG_USB_MUSB_DSPS +#define CONFIG_ARCH_MISC_INIT +#define CONFIG_MUSB_GADGET +#define CONFIG_MUSB_PIO_ONLY +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_MUSB_HOST +#define CONFIG_AM335X_USB0 +#define CONFIG_AM335X_USB0_MODEMUSB_PERIPHERAL +#define CONFIG_AM335X_USB1 +#define CONFIG_AM335X_USB1_MODE MUSB_HOST + +#ifdef CONFIG_MUSB_HOST +#define CONFIG_CMD_USB +#define CONFIG_USB_STORAGE +#endif + +#ifdef CONFIG_MUSB_GADGET +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#endif /* CONFIG_MUSB_GADGET */ + +/* Unsupported features */ +#undef CONFIG_USE_IRQ + #define CONFIG_CMD_NET #define CONFIG_CMD_DHCP #define CONFIG_CMD_PING -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 08/13] OMAP3: am35x_def.h: add USB defines
Add defines for MUSB IP block on AM35X SoCs. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- arch/arm/include/asm/arch-omap3/am35x_def.h | 27 +++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/include/asm/arch-omap3/am35x_def.h b/arch/arm/include/asm/arch-omap3/am35x_def.h index bbaf1bc..67698bc 100644 --- a/arch/arm/include/asm/arch-omap3/am35x_def.h +++ b/arch/arm/include/asm/arch-omap3/am35x_def.h @@ -32,9 +32,34 @@ #ifndef __KERNEL_STRICT_NAMES #ifndef __ASSEMBLY__ +/* LVL_INTR_CLEAR bits */ +#define USBOTGSS_INT_CLR (1 4) + /* IP_SW_RESET bits */ +#define USBOTGSS_SW_RST(1 0)/* reset USBOTG */ #define CPGMACSS_SW_RST(1 1)/* reset CPGMAC */ +/* DEVCONF2 bits */ +#define CONF2_PHY_GPIOMODE (1 23) +#define CONF2_OTGMODE (3 14) +#define CONF2_NO_OVERRIDE (0 14) +#define CONF2_FORCE_HOST (1 14) +#define CONF2_FORCE_DEVICE (2 14) +#define CONF2_FORCE_HOST_VBUS_LOW (3 14) +#define CONF2_SESENDEN (1 13) +#define CONF2_VBDTCTEN (1 12) +#define CONF2_REFFREQ_24MHZ(2 8) +#define CONF2_REFFREQ_26MHZ(7 8) +#define CONF2_REFFREQ_13MHZ(6 8) +#define CONF2_REFFREQ (0xf 8) +#define CONF2_PHYCLKGD (1 7) +#define CONF2_VBUSSENSE(1 6) +#define CONF2_PHY_PLLON(1 5) +#define CONF2_RESET(1 4) +#define CONF2_PHYPWRDN (1 3) +#define CONF2_OTGPWRDN (1 2) +#define CONF2_DATPOL (1 1) + /* General register mappings of system control module */ #define AM35X_SCM_GEN_BASE 0x48002270 struct am35x_scm_general { @@ -49,6 +74,8 @@ struct am35x_scm_general { }; #define am35x_scm_general_regs ((struct am35x_scm_general *)AM35X_SCM_GEN_BASE) +#define AM35XX_IPSS_USBOTGSS_BASE 0x5C04 + #endif /*__ASSEMBLY__ */ #endif /* __KERNEL_STRICT_NAMES */ -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 10/13] am3517_evm: switch to musb-new
Use new musb framework instead of the old one on AM3517_EVM. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- board/logicpd/am3517evm/am3517evm.c | 74 +++ include/configs/am3517_evm.h| 37 -- 2 files changed, 90 insertions(+), 21 deletions(-) diff --git a/board/logicpd/am3517evm/am3517evm.c b/board/logicpd/am3517evm/am3517evm.c index d316f33..0b3721e 100644 --- a/board/logicpd/am3517evm/am3517evm.c +++ b/board/logicpd/am3517evm/am3517evm.c @@ -25,12 +25,20 @@ #include common.h #include asm/io.h +#include asm/omap_musb.h +#include asm/arch/am35x_def.h #include asm/arch/mem.h #include asm/arch/mux.h #include asm/arch/sys_proto.h #include asm/arch/mmc_host_def.h +#include asm/arch/musb.h #include asm/mach-types.h +#include asm/errno.h +#include linux/usb/ch9.h +#include linux/usb/gadget.h +#include linux/usb/musb.h #include i2c.h +#include netdev.h #include am3517evm.h DECLARE_GLOBAL_DATA_PTR; @@ -50,6 +58,52 @@ int board_init(void) return 0; } +#ifdef CONFIG_USB_MUSB_AM35X +static struct musb_hdrc_config musb_config = { + .multipoint = 1, + .dyn_fifo = 1, + .num_eps= 16, + .ram_bits = 12, +}; + +static struct omap_musb_board_data musb_board_data = { + .set_phy_power = am35x_musb_phy_power, + .clear_irq = am35x_musb_clear_irq, + .reset = am35x_musb_reset, +}; + +static struct musb_hdrc_platform_data musb_plat = { +#if defined(CONFIG_MUSB_HOST) + .mode = MUSB_HOST, +#elif defined(CONFIG_MUSB_GADGET) + .mode = MUSB_PERIPHERAL, +#else +#error Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET +#endif + .config = musb_config, + .power = 250, + .platform_ops = am35x_ops, + .board_data = musb_board_data, +}; + +static void am3517_evm_musb_init(void) +{ + /* +* Set up USB clock/mode in the DEVCONF2 register. +* USB2.0 PHY reference clock is 13 MHz +*/ + clrsetbits_le32(am35x_scm_general_regs-devconf2, + CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE, + CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | + CONF2_VBDTCTEN | CONF2_DATPOL); + + musb_register(musb_plat, musb_board_data, + (void *)AM35XX_IPSS_USBOTGSS_BASE); +} +#else +#define am3517_evm_musb_init() do {} while (0) +#endif + /* * Routine: misc_init_r * Description: Init i2c, ethernet, etc... (done here so udelay works) @@ -62,6 +116,8 @@ int misc_init_r(void) dieid_num_r(); + am3517_evm_musb_init(); + return 0; } @@ -83,3 +139,21 @@ int board_mmc_init(bd_t *bis) return 0; } #endif + +#if defined(CONFIG_USB_ETHER) defined(CONFIG_MUSB_GADGET) +int board_eth_init(bd_t *bis) +{ + int rv, n = 0; + + rv = cpu_eth_init(bis); + if (rv 0) + n += rv; + + rv = usb_eth_initialize(bis); + if (rv 0) + n += rv; + + return n; +} +#endif + diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h index ce71d13..9484e55 100644 --- a/include/configs/am3517_evm.h +++ b/include/configs/am3517_evm.h @@ -97,15 +97,16 @@ /* * USB configuration - * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard - * Enable CONFIG_MUSB_UDC for Device functionalities. + * Enable CONFIG_MUSB_HOST for Host functionalities MSC, keyboard + * Enable CONFIG_MUSB_GADGET for Device functionalities. */ -#define CONFIG_USB_AM35X 1 -#define CONFIG_MUSB_HCD1 +#define CONFIG_USB_MUSB_AM35X +#define CONFIG_MUSB_HOST +#define CONFIG_MUSB_PIO_ONLY -#ifdef CONFIG_USB_AM35X +#ifdef CONFIG_USB_MUSB_AM35X -#ifdef CONFIG_MUSB_HCD +#ifdef CONFIG_MUSB_HOST #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE @@ -117,21 +118,15 @@ #define CONFIG_PREBOOT usb start #endif /* CONFIG_USB_KEYBOARD */ -#endif /* CONFIG_MUSB_HCD */ - -#ifdef CONFIG_MUSB_UDC -/* USB device configuration */ -#define CONFIG_USB_DEVICE 1 -#define CONFIG_USB_TTY 1 -#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 -/* Change these to suit your needs */ -#define CONFIG_USBD_VENDORID 0x0451 -#define CONFIG_USBD_PRODUCTID 0x5678 -#define CONFIG_USBD_MANUFACTURER Texas Instruments -#define CONFIG_USBD_PRODUCT_NAME AM3517EVM -#endif /* CONFIG_MUSB_UDC */ - -#endif /* CONFIG_USB_AM35X */ +#endif /* CONFIG_MUSB_HOST */ + +#ifdef CONFIG_MUSB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#endif /* CONFIG_MUSB_GADGET */ + +#endif /* CONFIG_USB_MUSB_AM35X */ /* commands to include */ #include config_cmd_default.h -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de
[U-Boot] [PATCH v5 11/13] musb-new: omap2plus backend driver
Backend driver for MUSB OTG controllers found on TI OMAP2/3/4 (tested only on OMAP3 Beagle). Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- arch/arm/include/asm/omap_musb.h|4 + drivers/usb/musb-new/Makefile |1 + drivers/usb/musb-new/linux-compat.h |9 + drivers/usb/musb-new/omap2430.c | 626 +++ drivers/usb/musb-new/omap2430.h | 56 include/usb.h |3 +- 6 files changed, 698 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/musb-new/omap2430.c create mode 100644 drivers/usb/musb-new/omap2430.h diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h index 46c8578..b04d865 100644 --- a/arch/arm/include/asm/omap_musb.h +++ b/arch/arm/include/asm/omap_musb.h @@ -19,10 +19,14 @@ extern struct musb_platform_ops musb_dsps_ops; extern const struct musb_platform_ops am35x_ops; +extern const struct musb_platform_ops omap2430_ops; struct omap_musb_board_data { + u8 interface_type; void (*set_phy_power)(u8 on); void (*clear_irq)(void); void (*reset)(void); }; + +enum musb_interface{MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; #endif /* __ASM_ARM_OMAP_MUSB_H */ diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile index 23fc735..c23bef1 100644 --- a/drivers/usb/musb-new/Makefile +++ b/drivers/usb/musb-new/Makefile @@ -11,6 +11,7 @@ COBJS-$(CONFIG_MUSB_GADGET) += musb_uboot.o COBJS-$(CONFIG_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o COBJS-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x.o +COBJS-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \ $(call cc-option,-Wno-unused-but-set-variable) \ diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h index 6ecdb3e..5c126ef 100644 --- a/drivers/usb/musb-new/linux-compat.h +++ b/drivers/usb/musb-new/linux-compat.h @@ -34,6 +34,7 @@ typedef unsigned long dmaaddr_t; #define spin_unlock_irqrestore(lock, flags) do {} while (0) #define setup_timer(timer, func, data) do {} while (0) +#define del_timer_sync(timer) do {} while (0) #define schedule_work(work) do {} while (0) #define INIT_WORK(work, fun) do {} while (0) @@ -104,4 +105,12 @@ typedef unsigned long dmaaddr_t; #endif #define msleep(a) udelay(a * 1000) + +/* + * Map U-Boot config options to Linux ones + */ +#ifdef CONFIG_OMAP34XX +#define CONFIG_SOC_OMAP3430 +#endif + #endif /* __LINUX_COMPAT_H__ */ diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c new file mode 100644 index 000..b1c4dc7 --- /dev/null +++ b/drivers/usb/musb-new/omap2430.c @@ -0,0 +1,626 @@ +/* + * Copyright (C) 2005-2007 by Texas Instruments + * Some code has been taken from tusb6010.c + * Copyrights for that are attributable to: + * Copyright (C) 2006 Nokia Corporation + * Tony Lindgren t...@atomide.com + * + * This file is part of the Inventra Controller Driver for Linux. + * + * The Inventra Controller Driver for Linux is free software; you + * can redistribute it and/or modify it under the terms of the GNU + * General Public License version 2 as published by the Free Software + * Foundation. + * + * The Inventra Controller Driver for Linux is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Inventra Controller Driver for Linux ; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place, + * Suite 330, Boston, MA 02111-1307 USA + * + */ +#define __UBOOT__ +#ifndef __UBOOT__ +#include linux/module.h +#include linux/kernel.h +#include linux/sched.h +#include linux/init.h +#include linux/list.h +#include linux/io.h +#include linux/platform_device.h +#include linux/dma-mapping.h +#include linux/pm_runtime.h +#include linux/err.h +#include linux/usb/musb-omap.h +#else +#include common.h +#include asm/omap_musb.h +#include twl4030.h +#include linux-compat.h +#endif + +#include musb_core.h +#include omap2430.h + +#ifndef __UBOOT__ +struct omap2430_glue { + struct device *dev; + struct platform_device *musb; + enum omap_musb_vbus_id_status status; + struct work_struct omap_musb_mailbox_work; +}; +#define glue_to_musb(g)platform_get_drvdata(g-musb) + +struct omap2430_glue *_glue; + +static struct timer_list musb_idle_timer; + +static void musb_do_idle(unsigned long _musb) +{ + struct musb *musb = (void *)_musb; + unsigned long flags; + u8 power; + u8 devctl; + + spin_lock_irqsave(musb-lock, flags); + + switch (musb-xceiv-state) { + case
[U-Boot] [PATCH v5 12/13] omap3_beagle: add musb-new init
Add initialization for new MUSB framework. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- board/ti/beagle/beagle.c | 43 include/configs/omap3_beagle.h |2 ++ 2 files changed, 45 insertions(+) diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 6175e1d..f20ebed 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -42,6 +42,11 @@ #include asm/arch/sys_proto.h #include asm/gpio.h #include asm/mach-types.h +#include asm/omap_musb.h +#include asm/errno.h +#include linux/usb/ch9.h +#include linux/usb/gadget.h +#include linux/usb/musb.h #include beagle.h #include command.h @@ -285,6 +290,33 @@ static void beagle_dvi_pup(void) } #endif +#ifdef CONFIG_USB_MUSB_OMAP2PLUS +static struct musb_hdrc_config musb_config = { + .multipoint = 1, + .dyn_fifo = 1, + .num_eps= 16, + .ram_bits = 12, +}; + +static struct omap_musb_board_data musb_board_data = { + .interface_type = MUSB_INTERFACE_ULPI, +}; + +static struct musb_hdrc_platform_data musb_plat = { +#if defined(CONFIG_MUSB_HOST) + .mode = MUSB_HOST, +#elif defined(CONFIG_MUSB_GADGET) + .mode = MUSB_PERIPHERAL, +#else +#error Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET +#endif + .config = musb_config, + .power = 100, + .platform_ops = omap2430_ops, + .board_data = musb_board_data, +}; +#endif + /* * Routine: misc_init_r * Description: Configure board specific parts @@ -466,6 +498,10 @@ int misc_init_r(void) omap3_dss_enable(); #endif +#ifdef CONFIG_USB_MUSB_OMAP2PLUS + musb_register(musb_plat, musb_board_data, (void *)MUSB_BASE); +#endif + return 0; } @@ -513,3 +549,10 @@ int ehci_hcd_stop(int index) } #endif /* CONFIG_USB_EHCI */ + +#if defined(CONFIG_USB_ETHER) defined(CONFIG_MUSB_GADGET) +int board_eth_init(bd_t *bis) +{ + return usb_eth_initialize(bis); +} +#endif diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 7a3cc16..b2d73f9 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -120,6 +120,8 @@ #define CONFIG_MUSB_UDC1 #define CONFIG_USB_OMAP3 1 #define CONFIG_TWL4030_USB 1 +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETHER_RNDIS /* USB device configuration */ #define CONFIG_USB_DEVICE 1 -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 09/13] OMAP3: am35x: add musb functions
AM35XX specific functions for integrated USB PHY/MUSB IP. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- arch/arm/cpu/armv7/omap3/Makefile |1 + arch/arm/cpu/armv7/omap3/am35x_musb.c | 75 arch/arm/include/asm/arch-omap3/musb.h | 28 3 files changed, 104 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap3/am35x_musb.c create mode 100644 arch/arm/include/asm/arch-omap3/musb.h diff --git a/arch/arm/cpu/armv7/omap3/Makefile b/arch/arm/cpu/armv7/omap3/Makefile index ac597be..de167ee 100644 --- a/arch/arm/cpu/armv7/omap3/Makefile +++ b/arch/arm/cpu/armv7/omap3/Makefile @@ -38,6 +38,7 @@ endif COBJS-$(CONFIG_DRIVER_TI_EMAC) += emac.o COBJS-$(CONFIG_EMIF4) += emif4.o COBJS-$(CONFIG_SDRC) += sdrc.o +COBJS-$(CONFIG_USB_MUSB_AM35X) += am35x_musb.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/omap3/am35x_musb.c b/arch/arm/cpu/armv7/omap3/am35x_musb.c new file mode 100644 index 000..7183c4f --- /dev/null +++ b/arch/arm/cpu/armv7/omap3/am35x_musb.c @@ -0,0 +1,75 @@ +/* + * This file configures the internal USB PHY in AM35X. + * + * Copyright (C) 2012 Ilya Yanok ilya.ya...@gmail.com + * + * Based on omap_phy_internal.c code from Linux by + * Hema HK hem...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc. + * + */ + +#include common.h +#include asm/io.h +#include asm/arch/am35x_def.h + +void am35x_musb_reset(void) +{ + /* Reset the musb interface */ + clrsetbits_le32(am35x_scm_general_regs-ip_sw_reset, + 0, USBOTGSS_SW_RST); + clrsetbits_le32(am35x_scm_general_regs-ip_sw_reset, + USBOTGSS_SW_RST, 0); +} + +void am35x_musb_phy_power(u8 on) +{ + unsigned long start = get_timer(0); + + if (on) { + /* +* Start the on-chip PHY and its PLL. +*/ + clrsetbits_le32(am35x_scm_general_regs-devconf2, + CONF2_RESET | CONF2_PHYPWRDN | CONF2_OTGPWRDN, + CONF2_PHY_PLLON); + + debug(Waiting for PHY clock good...\n); + while (!(readl(am35x_scm_general_regs-devconf2) +CONF2_PHYCLKGD)) { + + if (get_timer(start) CONFIG_SYS_HZ / 10) { + printf(musb PHY clock good timed out\n); + break; + } + } + } else { + /* +* Power down the on-chip PHY. +*/ + clrsetbits_le32(am35x_scm_general_regs-devconf2, + CONF2_PHY_PLLON, + CONF2_PHYPWRDN | CONF2_OTGPWRDN); + } +} + +void am35x_musb_clear_irq(void) +{ + clrsetbits_le32(am35x_scm_general_regs-lvl_intr_clr, + 0, USBOTGSS_INT_CLR); + readl(am35x_scm_general_regs-lvl_intr_clr); +} + diff --git a/arch/arm/include/asm/arch-omap3/musb.h b/arch/arm/include/asm/arch-omap3/musb.h new file mode 100644 index 000..423ac50 --- /dev/null +++ b/arch/arm/include/asm/arch-omap3/musb.h @@ -0,0 +1,28 @@ +/* + * (C) Copyright 2012 + * Ilya Yanok, ilya.ya...@gmail.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc. + */ + +#ifndef __ASM_ARCH_OMAP3_MUSB_H +#define __ASM_ARCH_OMAP3_MUSB_H +extern void am35x_musb_reset(void); +extern void am35x_musb_phy_power(u8 on); +extern void am35x_musb_clear_irq(void); +#endif -- 1.7.10.2 (Apple Git-33) ___ U-Boot
[U-Boot] [PATCH v5 13/13] omap3_beagle: use new MUSB intstead of the old one
Enable using of new MUSB framework on Beagle. NOTE! This is not just a change of backend code: top-level behavior is also changed, we now use USB device port for USB Ethernet instead of serial. Signed-off-by: Ilya Yanok ilya.ya...@cogentembedded.com --- include/configs/omap3_beagle.h | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index b2d73f9..8b99967 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -117,17 +117,14 @@ #define CONFIG_SYS_I2C_NOPROBES{{0x0, 0x0}} /* USB */ -#define CONFIG_MUSB_UDC1 -#define CONFIG_USB_OMAP3 1 +#define CONFIG_MUSB_GADGET +#define CONFIG_USB_MUSB_OMAP2PLUS +#define CONFIG_MUSB_PIO_ONLY +#define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_TWL4030_USB 1 #define CONFIG_USB_ETHER #define CONFIG_USB_ETHER_RNDIS -/* USB device configuration */ -#define CONFIG_USB_DEVICE 1 -#define CONFIG_USB_TTY 1 -#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 - /* USB EHCI */ #define CONFIG_CMD_USB #define CONFIG_USB_EHCI -- 1.7.10.2 (Apple Git-33) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/7] video: Implement additional video API functions in cfb_console
From: Stefan Reinauer reina...@chromium.org Implement the new video API functions to provide access to screen size, etc. Signed-off-by: Stefan Reinauer reina...@chromium.org Signed-off-by: Simon Glass s...@chromium.org Signed-off-by: Anatolij Gustschin ag...@denx.de --- Changes in v2: - fix compiler warning for some boards (ipek01, lwmon5, etc): cfb_console.c:2296:2: warning: implicit declaration of function 'memsetl' [-Wimplicit-function-declaration] - use background color in video_clear() drivers/video/cfb_console.c | 42 ++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 9c67b63..6f5d4f2 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2257,3 +2257,45 @@ int drv_video_init(void) /* Return success */ return 1; } + +void video_position_cursor(unsigned col, unsigned row) +{ + console_col = min(col, CONSOLE_COLS - 1); + console_row = min(row, CONSOLE_ROWS - 1); +} + +int video_get_pixel_width(void) +{ + return VIDEO_VISIBLE_COLS; +} + +int video_get_pixel_height(void) +{ + return VIDEO_VISIBLE_ROWS; +} + +int video_get_screen_rows(void) +{ + return CONSOLE_ROWS; +} + +int video_get_screen_columns(void) +{ + return CONSOLE_COLS; +} + +void video_clear(void) +{ +#ifdef VIDEO_HW_RECTFILL + video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */ + 0,/* dest pos x */ + 0,/* dest pos y */ + VIDEO_VISIBLE_COLS, /* frame width */ + VIDEO_VISIBLE_ROWS, /* frame height */ + bgx /* fill color */ + ); +#else + memsetl(video_fb_address, + (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), bgx); +#endif +} -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 0/8] Add TMU support for Exynos5250 based SMDK5250
Hi Hatim, On Tue, Nov 6, 2012 at 2:18 AM, Hatim Ali hatim...@samsung.com wrote: The patch series add support for TMU driver using device tree for Exynos5250 based SMDK5250 board. This patch series is dependent on the patch series Add DT based ethernet driver for SMDK5250 by Hatim Ali Akshay Saraswat (5): EXYNOS5: FDT: Add TMU device node values EXYNOS5: TMU: Add driver for Thermal Management Unit EXYNOS5: Power down API for Thermal Management Unit GEN: Add a poll function to monitor events EXYNOS5: TMU: Add TMU status polling Alim Akhtar (1): GEN: TMU: Add u-boot command to read current temp Hatim Ali (2): EXYNOS5: Config: Enable support for Exynos TMU driver EXYNOS5: Config: Enable tmu command This series generally looks good to me. I have a few comments which I will attach to individual patches. Regards, Simon README|7 + arch/arm/cpu/armv7/exynos/power.c | 11 + arch/arm/dts/exynos5250.dtsi |5 + arch/arm/include/asm/arch-exynos/exynos-tmu.h | 82 +++ arch/arm/include/asm/arch-exynos/power.h |4 + board/samsung/dts/exynos5250-smdk5250.dts | 13 + board/samsung/smdk5250/smdk5250.c | 36 +++ common/Makefile |1 + common/cmd_tmu.c | 51 + common/console.c |5 + doc/device-tree-bindings/exynos/tmu.txt | 35 +++ drivers/power/Makefile|1 + drivers/power/exynos-tmu.c| 296 + include/common.h |8 + include/configs/exynos5250-dt.h |7 + include/fdtdec.h |1 + lib/fdtdec.c |1 + 17 files changed, 564 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/exynos-tmu.h create mode 100644 common/cmd_tmu.c create mode 100644 doc/device-tree-bindings/exynos/tmu.txt create mode 100644 drivers/power/exynos-tmu.c -- 1.7.2.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/8] EXYNOS5: FDT: Add TMU device node values
On Tue, Nov 6, 2012 at 2:18 AM, Hatim Ali hatim...@samsung.com wrote: From: Akshay Saraswat aksha...@samsung.com Fdt entry for Exynos TMU driver specific pre-defined values used for calibration of current temperature and defining threshold values. Signed-off-by: Akshay Saraswat aksha...@samsung.com Acked-by: Simon Glass s...@chromium.org ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/8] EXYNOS5: TMU: Add driver for Thermal Management Unit
On Tue, Nov 6, 2012 at 2:18 AM, Hatim Ali hatim...@samsung.com wrote: From: Akshay Saraswat aksha...@samsung.com Adding Exynos Thermal Management Unit driver to monitor SOC temperature and take actions corresponding to states of TMU. System will shutdown if tripping temperature is reached. Signed-off-by: Akshay Saraswat aksha...@samsung.com Acked-by: Simon Glass s...@chromium.org ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/8] EXYNOS5: Power down API for Thermal Management Unit
Hi Hatim, On Tue, Nov 6, 2012 at 2:18 AM, Hatim Ali hatim...@samsung.com wrote: From: Akshay Saraswat aksha...@samsung.com Adding API in power for system shutdown when tripping value is reached in Exynos Thermal Management Unit. Signed-off-by: Akshay Saraswat aksha...@samsung.com diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c index d4bce6d..a6d8827 100644 --- a/arch/arm/cpu/armv7/exynos/power.c +++ b/arch/arm/cpu/armv7/exynos/power.c @@ -95,3 +95,14 @@ void set_dp_phy_ctrl(unsigned int enable) if (cpu_is_exynos5()) exynos5_dp_phy_control(enable); } + +/* This function never returns */ +void power_shutdown(void) +{ + struct exynos5_power *power = + (struct exynos5_power *)samsung_get_base_power(); + + clrbits_le32(power-ps_hold_control, POWER_PS_HOLD_CONTROL_DATA_HIGH); + + hang(); +} diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h index d2fdb59..7d798ba 100644 --- a/arch/arm/include/asm/arch-exynos/power.h +++ b/arch/arm/include/asm/arch-exynos/power.h @@ -863,5 +863,9 @@ void set_usbhost_phy_ctrl(unsigned int enable); void set_dp_phy_ctrl(unsigned int enable); #define EXYNOS_DP_PHY_ENABLE (1 0) +#define POWER_PS_HOLD_CONTROL_DATA_HIGH (1 8) + +/* This function never returns */ Probably should document what it does do. Also you could add __attribute__ ((noreturn)) perhaps? +void power_shutdown(void); #endif -- 1.7.2.3 Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/8] GEN: Add a poll function to monitor events
Hi, On Tue, Nov 6, 2012 at 2:18 AM, Hatim Ali hatim...@samsung.com wrote: From: Akshay Saraswat aksha...@samsung.com Add a generic polling function to continuously monitor events and trigger actions corresponding to them. Signed-off-by: Akshay Saraswat aksha...@samsung.com For mainline I think the GEN tag should be removed. diff --git a/README b/README index 2572add..72b3b67 100644 --- a/README +++ b/README @@ -2814,6 +2814,13 @@ Configuration Settings: the application (usually a Linux kernel) when it is booted +- CONFIG_BOARD_POLL + There are various scenarios in which parallel-thread like + polling is required to monitor status of variety of devices. + For such situations CONFIG_BOARD_POLL shall be enabled + and funtion call board_poll_devices() from console_tstc() + will then poll for the device status as defined inside function. + - CONFIG_SYS_BAUDRATE_TABLE: List of legal baudrate settings for this board. diff --git a/common/console.c b/common/console.c index 1177f7d..d320b9b 100644 --- a/common/console.c +++ b/common/console.c @@ -117,6 +117,11 @@ static int console_tstc(int file) int i, ret; struct stdio_dev *dev; +#if defined CONFIG_BOARD_POLL + /* Generic polling function */ + board_poll_devices(); +#endif + disable_ctrlc(1); for (i = 0; i cd_count[file]; i++) { dev = console_devices[file][i]; diff --git a/include/common.h b/include/common.h index b23e90b..cba2e3b 100644 --- a/include/common.h +++ b/include/common.h @@ -782,6 +782,14 @@ void clear_ctrlc (void); /* clear the Control-C condition */ intdisable_ctrlc (int);/* 1 to disable, 0 to enable Control-C detect */ /* + * A generic polling function + * This will be called to poll for some events, + * In this case this will be called form console_tstc() to monitor typo: form + * temperatur of the SOC + */ +void board_poll_devices(void); + +/* * STDIO based functions (can always be used) */ /* serial stuff */ -- 1.7.2.3 Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot