Re: [PATCH v1] colibri_t20: change maintainer
Am Montag, den 13.04.2020, 18:11 +0300 schrieb Igor Opaniuk: > From: Igor Opaniuk > > Take over maintainership for Colibri T20 module. > > Signed-off-by: Igor Opaniuk Acked-by: Lucas Stach > --- > > board/toradex/colibri_t20/MAINTAINERS | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/board/toradex/colibri_t20/MAINTAINERS > b/board/toradex/colibri_t20/MAINTAINERS > index b251c000fe..2a8e6fb74b 100644 > --- a/board/toradex/colibri_t20/MAINTAINERS > +++ b/board/toradex/colibri_t20/MAINTAINERS > @@ -1,5 +1,5 @@ > COLIBRI_T20 > -M: Lucas Stach > +M: Igor Opaniuk > S: Maintained > F: board/toradex/colibri_t20/ > F: include/configs/colibri_t20.h
Re: [U-Boot] [PATCH 0/4] tegra: Move tegra20 towards the 'new' display bindings
Am Donnerstag, den 14.01.2016, 13:26 -0700 schrieb Simon Glass: > The original tegra20 display driver was written before Linux had > device tree > bindings for display. Since then Linux has developed a robust set of > bindings > covering various aspects of enabling a display. > > This series moves closer to those bindings by using the panel and > backlight > as separate drivers. The device tree files for seaboard, ventana and > harmony > thereby become almost the same as Linux. > > Unfortunately this breaks the other boards, which will need a similar > sync. > So I'm not sure how easy it will be to accept this series. Still, it > seems > worth sending it out in the hope that board maintainers can help. I > have > kept this series separate so that it can progress separately. > By pushing display timings into the DT you are actually diverging from mainline, as mainline doesn't require this, but instead infers the timings from the panel compatible. Is this a desired goal? Regards, Lucas > > Simon Glass (4): > tegra: dts: Sync seaboard device tree file with Linux > video: tegra: Move to using simple-panel and pwm-backlight > tegra: video: Always use write-through cache on LCD > fdt: Drop some unused compatible strings > > arch/arm/dts/tegra20-harmony.dts | 751 > -- > arch/arm/dts/tegra20-seaboard.dts | 934 > ++ > arch/arm/dts/tegra20-ventana.dts | 685 ++-- > configs/colibri_t20_defconfig | 5 +- > configs/harmony_defconfig | 5 +- > configs/medcom-wide_defconfig | 5 +- > configs/paz00_defconfig | 5 +- > configs/seaboard_defconfig| 5 +- > configs/tec_defconfig | 5 +- > configs/ventana_defconfig | 5 +- > drivers/video/tegra.c | 333 +++--- > include/fdtdec.h | 4 - > lib/fdtdec.c | 4 - > 13 files changed, 2307 insertions(+), 439 deletions(-) > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: use a CPU freq that all SKUs can support
Hi Stephen, I was just porting this change to barebox and stumbled upon a few errors here. Am Donnerstag, den 24.04.2014, 13:30 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com [...] diff --git a/arch/arm/cpu/arm720t/tegra30/cpu.c b/arch/arm/cpu/arm720t/tegra30/cpu.c index 85a945bc7918..0f52e54239e1 100644 --- a/arch/arm/cpu/arm720t/tegra30/cpu.c +++ b/arch/arm/cpu/arm720t/tegra30/cpu.c @@ -41,10 +41,18 @@ void tegra_i2c_ll_write_data(uint data, uint config) writel(config, reg-cnfg); } +#define TPS62366A_I2C_ADDR 0x60 The I2C address for this chip on Beaver is 0xc0, not 0x60. I don't know about Cardhu. +#define TPS62366A_SET1_REG 0x01 +#define TPS62366A_SET1_DATA (0x46 | TPS62366A_SET1_REG) This should be (0x4600 | TPS62366A_SET1_REG). + +#define TPS62361B_I2C_ADDR 0x60 +#define TPS62361B_SET3_REG 0x03 +#define TPS62361B_SET3_DATA (0x46 | TPS62361B_SET3_REG) Same here. Only with those fixed I can verify vdd_core to ramp up to 1,2V on Beaver. Without the changes vdd_core stays at the default 1,16V. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] ARM: tegra: make CONFIG_CMD_PART common
Am Mittwoch, den 27.02.2013, 14:03 -0700 schrieb Stephen Warren: On 02/26/2013 04:00 PM, Stephen Warren wrote: This is useful on all Tegras, so that boot.scr on all devices can use the same commands. Hence, move it to tegra-common.h. Unfortunately, this breaks Tegra114 builds because no partition types are enabled, and CONFIG_CMD_PART requires functionality that's only enabled if some partition types are supported. There are two possible solutions: 1) Conditionally enable PARTITION_UUIDS and CMD_PART in tegra-common-post.h only if some partition type is enabled. 2) Also enable DOS and EFI partitions in tegra-common.h, along with all of FS_EXT4, FS_FAT, CMD_EXT2, CMD_FAT, CMD_FS_GENERIC. For most boards this won't be any change. For the Colibri T20 and Avionic Design boards, this ends up enabling a few more options. (or perhaps enable all of those in tegra-common-post.h only if support for any block device is enabled) I prefer option (2). Does anyone object? No objections. There is no real reason to leave out all those options as we are not size limited on the Colibri. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 1/3] Tegra: fdt: Add/enhance sdhci (mmc) nodes for all T20 DT files
Am Donnerstag, den 14.02.2013, 13:24 -0700 schrieb Stephen Warren: [...] The one issue with this is that only newer versions of dtc support the -i option. The version packaged with most distros won't support it. That'll mean something like MAKEALL -a arm is going to fail for a lot of people without some kind of explicit action (i.e. manually installing a newer version of dtc). That's why I suggested switching from /include/ to #include, and adding the include path to the cpp command rather than dtc. I tried using '#include, and added the 2 dts paths to the DTS_CPPFLAGS so gcc could find the files, but I got a 'couldn't open 'skeleton.dtsi' error. I didn't want to change tegra20.dtsi to #include skeleton.dtsi', and all the other board dts files to #include ARCH_CPU_DTS, just so we can support the common tamonten dtsi, so I went back to the DTC include path changes. I think that's exactly where we should end up though. It's certainly the way the kernel is also heading. Right now, the Avionic Design boards might be the only place this problem crops up, but as we support more features on Cardhu, we'll hit exactly the same issue, so have to solve it there too. Right now the AD boards might be the only ones with this problem, but it will certainly hit the Toradex Tegra designs also. I'm planning on doing support for the Colibri Evaluation Carrier for the next release cycle. So I need to split up the DTS between Colibri and Carrier board, same as is done in the Linux Kernel dts. There was talk at one time of putting an up-to-date DTC binary in the U-Boot tools area so everyone would have a consistent level of DT support. I think Wolfgang nak'd that. With the small number of boards using DT at this time, I think we can live with letting people know where to find the latest DTC release until then. But he also nak'd the idea of relying on a newer dtc:-( I think we had better raise the question again. Yes, this has to be resolved one way or the other. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3 0/7] Move Tegra EHCI drive to correct place
Am Donnerstag, den 14.02.2013, 17:27 +0100 schrieb Marek Vasut: Dear Lucas Stach, This moves out the Tegra EHCI driver from a platform specific directory to the standard driver/usb/host dir. This is a preparation needed to share this driver between Tegra20 and Tegra30. No functional change in here, so Tegra30 is still not working. Patch 6 could be a lot smaller if it were generated with -B, as GIT would detect that most of it is moving stuff over, but last time I did this it prevented git apply to work. So sorry for the big diff. I think I incorporated all changes needed to reflect the review feedback I got on this last time. V3 is rebased onto u-boot-tegra/next, fixes a build warning and has Simons acked-by attached to the patches. I expect this series to go in through the Tegra tree. Marek, I suppose you are OK with the series, as you already were about to apply them in V2 form, please ACK so Tom can pick them up. Lucas Stach (7): tegra: usb: set USB_PORTS_MAX to correct value tegra: usb: make controller init functions more self contained tegra: usb: remove unneeded function parameter tegra: usb: move controller init into start_port tegra: usb: various small cleanups tegra: usb: move implementation into right directory tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop] arch/arm/cpu/armv7/tegra20/Makefile | 1 - arch/arm/cpu/armv7/tegra20/usb.c | 567 -- arch/arm/include/asm/arch-tegra/usb.h | 249 + arch/arm/include/asm/arch-tegra20/tegra.h | 1 - arch/arm/include/asm/arch-tegra20/usb.h | 271 -- arch/arm/include/asm/arch-tegra30/tegra.h | 2 + board/nvidia/common/board.c | 2 +- drivers/usb/host/ehci-tegra.c | 546 +++- 8 files changed, 782 insertions(+), 857 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra20/usb.c create mode 100644 arch/arm/include/asm/arch-tegra/usb.h delete mode 100644 arch/arm/include/asm/arch-tegra20/usb.h These will go through the tegra tree, yes? Otherwise I'm fine with these patches. Yes, they are intended to go through the Tegra tree. I think Tom will pick them up for his next PR. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 0/4] Tegra: MMC: Add DT support for MMC to T20 boards
Am Donnerstag, den 14.02.2013, 14:03 -0700 schrieb Tom Warren: This patchset adds device-tree support to the Tegra MMC driver. All device config is done via properties in the DT files instead of hard-coded config options/function arguments. I've tested this on my Seaboard and everything works fine, including card detect. For the other T20 boards, I've used the Linux kernel DTS files for the sdhci nodes where there wasn't one already, or expanded the info that was already there. Everything builds fine, but I haven't tested anything but Seaboard. v2: Changes as per Stephen's Simon's review v3: Changes as per Stephen/Lucas/Thierry/Simon's feedback v4: Additional changes as per Stephen/Lucas/Thierry/Simon Tom Warren (4): fdt: Add dts/dtsi file include paths to DTC command line Tegra: fdt: Add/enhance sdhci (mmc) nodes for all T20 DT files Tegra: fdt: tamonten: Add common tamonten.dtsi file from linux Tegra: MMC: Add DT support to MMC driver for all T20 boards When applying, patches 2 and 3 should be swapped around to avoid intermediate breakage in the series. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 2/2] Tegra: MMC: Add DT support to MMC driver for all T20 boards
Hello Tom, Am Dienstag, den 12.02.2013, 12:24 -0700 schrieb Tom Warren: Lucas, tegra_mmc_init should not be called from every individual board file, but from the common nvidia tegra board file. Only the pinmux should stay in the individual board code, same thing as was done to all the other functions like NAND and USB. True. I was originally just adapting the current config-file driven MMC to DT step-by-step, but you're right - it should be called just once for all boards in the common board file. I'll change it in V3. I've looked into this some more, and it appears that I can't just add a call to tegra_mmc_init() from board_init() in boards/nvidia/common/board.c. board_init() is where the other periphs do their pin_mux and xxx_init() calls (USB, SPI, etc.). board_init() is called early in board_init_r(), before mmc_initialize() is called. mmc_initialize() is needed before tegra_mmc_init() can use the mmc_device struct, etc. So tegra_mmc_init() needs to be called after mmc_initialize(), and right now that's in each board's board_mmc_init(). In board_mmc_init(), each board sets up any power rails needed for SD-card or eMMC access, sets up it's pin muxes for MMC, and then calls tegra_mmc_init() to parse the DT file and populate the mmc structs. I could move the pin_mux_mmc() function calls from each board file into nvidia/common/board.c's board_init(), but it wouldn't really change much. So I'll leave it as it is for now, with pin_mux_mmc() and tegra_mmc_init() being called from each board's 'board' file (seaboard.c, colibri_t20_iris.c, etc). Let me know if you see another way to move Tegra MMC init to a common board file that doesn't break the MMC driver flow. I didn't look up the flow myself, as I don't have time for that right now, but I think I've got a pretty good picture from your description. I think we should really try to make the Tegra MMC init flow as similar as possible to the other peripherals, so I suggest doing the following: 1. Provide a pin_mux_mmc() (possibly with a weak define as done with other peripherals). Boards should do pinmux and rail enabling within this function. 2. Move board_mmc_init() into nvidia/common/board.c, this function should call into the board specific pinmux function and then call tegra_mmc_init(). So even while we don't get the complete same flow as for other peripherals as the board_mmc_init() still has to be a freestanding function, instead of those things being folded into board_init(), we at least gain a clear distinction between the board specific parts and Tegra common code. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] Tegra: fdt: Add/enhance sdhci (mmc) nodes for all T20 DT files
Hi Tom, Am Montag, den 11.02.2013, 10:17 -0700 schrieb Tom Warren: Linux dts files were used for those boards that didn't already have sdhci info populated. Tamonten has their own dtsi file with common sdhci nodes (sourced from Linux). Signed-off-by: Tom Warren twar...@nvidia.com --- v2: - cleanup comments in dts files/match w/kernel files - add sdhci aliases in all dts files - use tegra20-tamonten.dtsi from the kernel for AD boards arch/arm/dts/tegra20-tamonten.dtsi | 489 ++ I'm not sure if pushing the whole file in this patch is the right thing to do. arch/arm/dts/tegra20.dtsi| 16 +- board/avionic-design/dts/tegra20-medcom-wide.dts |1 + board/avionic-design/dts/tegra20-plutux.dts |1 + board/avionic-design/dts/tegra20-tec.dts |1 + board/compal/dts/tegra20-paz00.dts | 19 +- board/compulab/dts/tegra20-trimslice.dts | 14 + board/nvidia/dts/tegra20-harmony.dts | 18 + board/nvidia/dts/tegra20-seaboard.dts| 12 +- board/nvidia/dts/tegra20-ventana.dts | 15 + board/nvidia/dts/tegra20-whistler.dts| 13 + board/toradex/dts/tegra20-colibri_t20_iris.dts |6 + 12 files changed, 595 insertions(+), 10 deletions(-) create mode 100644 arch/arm/dts/tegra20-tamonten.dtsi [...] diff --git a/board/toradex/dts/tegra20-colibri_t20_iris.dts b/board/toradex/dts/tegra20-colibri_t20_iris.dts index c29b43a..0dd4c43 100644 --- a/board/toradex/dts/tegra20-colibri_t20_iris.dts +++ b/board/toradex/dts/tegra20-colibri_t20_iris.dts @@ -10,6 +10,7 @@ usb0 = /usb@c5008000; usb1 = /usb@c500; usb2 = /usb@c5004000; + sdhci0 = /sdhci@c8000600; }; usb@c500 { @@ -35,4 +36,9 @@ compatible = nand-flash; }; }; + + sdhci@c8000600 { + status = okay; + bus-width = 4; You are missing the CD GPIO here. It's PC7. + }; }; Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 2/2] Tegra: MMC: Add DT support to MMC driver for all T20 boards
Am Montag, den 11.02.2013, 10:17 -0700 schrieb Tom Warren: tegra_mmc_init() now parses the DT info for bus width, WP/CD GPIOs, etc. Tested on Seaboard, fully functional. Tamonten boards (medcom-wide, plutux, and tec) use a different/new dtsi file w/common settings. Signed-off-by: Tom Warren twar...@nvidia.com --- v2: - all boards now call tegra_mmc_init once, w/no params - count MMC controllers, not aliases - AD boards (medcom/plutux/tec) use common tegra20-tamonten.dtsi arch/arm/include/asm/arch-tegra/mmc.h |2 +- arch/arm/include/asm/arch-tegra/tegra_mmc.h | 13 +- board/avionic-design/common/tamonten.c|4 +- board/compal/paz00/paz00.c| 11 +- board/compulab/trimslice/trimslice.c |9 +- board/nvidia/harmony/harmony.c| 11 +- board/nvidia/seaboard/seaboard.c | 11 +- board/nvidia/whistler/whistler.c |7 +- board/toradex/colibri_t20_iris/colibri_t20_iris.c |2 +- drivers/mmc/tegra_mmc.c | 259 + include/configs/medcom-wide.h |2 + include/configs/plutux.h |2 + include/configs/tec.h |2 + include/fdtdec.h |1 + lib/fdtdec.c |1 + 15 files changed, 197 insertions(+), 140 deletions(-) [...] diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c index 93430ed..fba06c2 100644 --- a/board/nvidia/harmony/harmony.c +++ b/board/nvidia/harmony/harmony.c @@ -58,18 +58,13 @@ static void pin_mux_mmc(void) /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { - debug(board_mmc_init called\n); + debug(%s called\n, __func__); /* Enable muxes, etc. for SDMMC controllers */ pin_mux_mmc(); - debug(board_mmc_init: init SD slot J26\n); - /* init dev 0, SD slot J26, with 8-bit bus */ - tegra_mmc_init(0, 8, GPIO_PI6, GPIO_PH2); - - debug(board_mmc_init: init SD slot J5\n); - /* init dev 2, SD slot J5, with 4-bit bus */ - tegra_mmc_init(2, 4, GPIO_PT3, GPIO_PI5); + debug(%s: init MMC devs\n, __func__); + tegra_mmc_init(); tegra_mmc_init should not be called from every individual board file, but from the common nvidia tegra board file. Only the pinmux should stay in the individual board code, same thing as was done to all the other functions like NAND and USB. return 0; } [...] Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] Tegra: fdt: Add/enhance sdhci (mmc) nodes for all T20 DT files
Am Montag, den 11.02.2013, 10:56 -0700 schrieb Tom Warren: Lucas, On Mon, Feb 11, 2013 at 10:28 AM, Lucas Stach d...@lynxeye.de wrote: Hi Tom, Am Montag, den 11.02.2013, 10:17 -0700 schrieb Tom Warren: Linux dts files were used for those boards that didn't already have sdhci info populated. Tamonten has their own dtsi file with common sdhci nodes (sourced from Linux). Signed-off-by: Tom Warren twar...@nvidia.com --- v2: - cleanup comments in dts files/match w/kernel files - add sdhci aliases in all dts files - use tegra20-tamonten.dtsi from the kernel for AD boards arch/arm/dts/tegra20-tamonten.dtsi | 489 ++ I'm not sure if pushing the whole file in this patch is the right thing to do. I didn't want to edit it since we seem to be moving towards using the Linux DTS files in toto in U-Boot (as per Stephen Simon). Does it do any harm to have the whole thing here? Saves some work later. Thierry - what do you think? I'm not objecting against pulling in the kernel dtsi in general, as I think most of the things in there like pinmux will become handy in a bit. I would just like to see this huge chunk in a separate patch and this one would then just add the aliases. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/7] Move Tegra EHCI drive to correct place
This moves out the Tegra EHCI driver from a platform specific directory to the standard driver/usb/host dir. This is a preparation needed to share this driver between Tegra20 and Tegra30. No functional change in here, so Tegra30 is still not working. Patch 6 could be a lot smaller if it were generated with -B, as GIT would detect that most of it is moving stuff over, but last time I did this it prevented git apply to work. So sorry for the big diff. I think I incorporated all changes needed to reflect the review feedback I got on this last time. V3 is rebased onto u-boot-tegra/next, fixes a build warning and has Simons acked-by attached to the patches. I expect this series to go in through the Tegra tree. Marek, I suppose you are OK with the series, as you already were about to apply them in V2 form, please ACK so Tom can pick them up. Lucas Stach (7): tegra: usb: set USB_PORTS_MAX to correct value tegra: usb: make controller init functions more self contained tegra: usb: remove unneeded function parameter tegra: usb: move controller init into start_port tegra: usb: various small cleanups tegra: usb: move implementation into right directory tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop] arch/arm/cpu/armv7/tegra20/Makefile | 1 - arch/arm/cpu/armv7/tegra20/usb.c | 567 -- arch/arm/include/asm/arch-tegra/usb.h | 249 + arch/arm/include/asm/arch-tegra20/tegra.h | 1 - arch/arm/include/asm/arch-tegra20/usb.h | 271 -- arch/arm/include/asm/arch-tegra30/tegra.h | 2 + board/nvidia/common/board.c | 2 +- drivers/usb/host/ehci-tegra.c | 546 +++- 8 files changed, 782 insertions(+), 857 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra20/usb.c create mode 100644 arch/arm/include/asm/arch-tegra/usb.h delete mode 100644 arch/arm/include/asm/arch-tegra20/usb.h -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 4/7] tegra: usb: move controller init into start_port
There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- v2: - remember if port is already initialized and skip init in that case --- arch/arm/cpu/armv7/tegra20/usb.c | 57 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 2007483..e4165e0 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -79,6 +79,7 @@ struct fdt_usb { unsigned ulpi:1;/* 1 if port has external ULPI transceiver */ unsigned enabled:1; /* 1 to enable, 0 to disable */ unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */ + unsigned initialized:1; /* has this port already been initialized? */ enum dr_mode dr_mode; /* dual role mode */ enum periph_id periph_id;/* peripheral id */ struct fdt_gpio_state vbus_gpio;/* GPIO for vbus enable */ @@ -426,44 +427,36 @@ static void config_clock(const u32 timing[]) timing[PARAM_CPCON], timing[PARAM_LFCON]); } -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) { - if (port_count == USB_PORTS_MAX) { - printf(tegrausb: Cannot register more than %d ports\n, - USB_PORTS_MAX); + struct fdt_usb *config; + struct usb_ctlr *usbctlr; + + if (portnum = port_count) return -1; - } + + config = port[portnum]; + + /* skip init, if the port is already initialized */ + if (config-initialized) + goto success; if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } - port[port_count++] = *config; - - return 0; -} - -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct usb_ctlr *usbctlr; + set_host_mode(config); - if (portnum = port_count) - return -1; - set_host_mode(port[portnum]); + config-initialized = 1; - usbctlr = port[portnum].reg; +success: + usbctlr = config-reg; *hccr = (u32)usbctlr-cap_length; *hcor = (u32)usbctlr-usb_cmd; return 0; @@ -483,6 +476,8 @@ int tegrausb_stop_port(int portnum) writel(2, usbctlr-usb_cmd); udelay(1000); + port[portnum].initialized = 0; + return 0; } @@ -546,6 +541,12 @@ int board_usb_init(const void *blob) count = fdtdec_find_aliases_for_id(blob, usb, COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX); for (i = 0; i count; i++) { + if (port_count == USB_PORTS_MAX) { + printf(tegrausb: Cannot register more than %d ports\n, + USB_PORTS_MAX); + return -1; + } + debug(USB %d: , i); node = node_list[i]; if (!node) @@ -555,10 +556,10 @@ int board_usb_init(const void *blob) fdt_get_name(blob, node, NULL)); return -1; } + config.initialized = 0; - if (add_port(config)) - return -1; - set_host_mode(config); + /* add new USB port to the list of available ports */ + port[port_count++] = config; } return 0; -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 1/7] tegra: usb: set USB_PORTS_MAX to correct value
Both Tegra20 and Tegra30 have a max of 3 USB controllers. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..f151fb2 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -44,7 +44,7 @@ #endif enum { - USB_PORTS_MAX = 4,/* Maximum ports we allow */ + USB_PORTS_MAX = 3,/* Maximum ports we allow */ }; /* Parameters we need for USB */ -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 2/7] tegra: usb: make controller init functions more self contained
There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own. This allows to move out the controller init into ehci_hcd_init later on, without having to save away global state for later use and thus bloating the file global state. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/usb.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index f151fb2..07c1ade 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -198,11 +198,12 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) } /* set up the UTMI USB controller with the parameters provided */ -static int init_utmi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr, const u32 timing[]) +static int init_utmi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; + const unsigned *timing; + struct usb_ctlr *usbctlr = config-reg; clock_enable(config-periph_id); @@ -229,6 +230,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config, * PLL Delay CONFIGURATION settings. The following parameters control * the bring up of the plls. */ + timing = usb_pll[clock_get_osc_freq()]; + val = readl(usbctlr-utmip_misc_cfg1); clrsetbits_le32(val, UTMIP_PLLU_STABLE_COUNT_MASK, timing[PARAM_STABLE_COUNT] UTMIP_PLLU_STABLE_COUNT_SHIFT); @@ -331,12 +334,12 @@ static int init_utmi_usb_controller(struct fdt_usb *config, #endif /* set up the ULPI USB controller with the parameters provided */ -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; struct ulpi_viewport ulpi_vp; + struct usb_ctlr *usbctlr = config-reg; /* set up ULPI reference clock on pllp_out4 */ clock_enable(PERIPH_ID_DEV2_OUT); @@ -408,8 +411,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config, return 0; } #else -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { printf(No code to set up ULPI controller, please enable CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT); @@ -430,22 +432,20 @@ static void config_clock(const u32 timing[]) * @param config USB port configuration * @return 0 if ok, -1 if error (too many ports) */ -static int add_port(struct fdt_usb *config, const u32 timing[]) +static int add_port(struct fdt_usb *config) { - struct usb_ctlr *usbctlr = config-reg; - if (port_count == USB_PORTS_MAX) { printf(tegrausb: Cannot register more than %d ports\n, USB_PORTS_MAX); return -1; } - if (config-utmi init_utmi_usb_controller(config, usbctlr, timing)) { + if (config-utmi init_utmi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } - if (config-ulpi init_ulpi_usb_controller(config, usbctlr)) { + if (config-ulpi init_ulpi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } @@ -558,7 +558,7 @@ int board_usb_init(const void *blob) return -1; } - if (add_port(config, usb_pll[freq])) + if (add_port(config)) return -1; set_host_mode(config); } -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 3/7] tegra: usb: remove unneeded function parameter
Just a dead parameter, never actually used. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/usb.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 07c1ade..2007483 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -486,8 +486,7 @@ int tegrausb_stop_port(int portnum) return 0; } -int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, - struct fdt_usb *config) +int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -535,7 +534,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, int board_usb_init(const void *blob) { struct fdt_usb config; - unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC); enum clock_osc_freq freq; int node_list[USB_PORTS_MAX]; int node, count, i; @@ -552,7 +550,7 @@ int board_usb_init(const void *blob) node = node_list[i]; if (!node) continue; - if (fdt_decode_usb(blob, node, osc_freq, config)) { + if (fdt_decode_usb(blob, node, config)) { debug(Cannot decode USB node %s\n, fdt_get_name(blob, node, NULL)); return -1; -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 5/7] tegra: usb: various small cleanups
Remove unneeded headers, function prototype and stale comment, that doesn't match the actual codebase anymore. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/usb.c| 13 + arch/arm/include/asm/arch-tegra20/usb.h | 3 --- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index e4165e0..3fdd5df 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -25,21 +25,15 @@ #include asm/io.h #include asm-generic/gpio.h #include asm/arch/clock.h -#include asm/arch/gpio.h -#include asm/arch/pinmux.h -#include asm/arch/tegra.h #include asm/arch/usb.h #include usb/ulpi.h -#include asm/arch-tegra/clk_rst.h -#include asm/arch-tegra/sys_proto.h -#include asm/arch-tegra/uart.h #include libfdt.h #include fdtdec.h #ifdef CONFIG_USB_ULPI #ifndef CONFIG_USB_ULPI_VIEWPORT #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ - define CONFIG_USB_ULPI_VIEWPORT + define CONFIG_USB_ULPI_VIEWPORT #endif #endif @@ -191,11 +185,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) /* Enable the UTMIP PHY */ if (config-utmi) setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB); - - /* -* TODO: where do we take the USB1 out of reset? The old code would -* take USB3 out of reset, but not USB1. This code doesn't do either. -*/ } /* set up the UTMI USB controller with the parameters provided */ diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h index fdbd127..b18c850 100644 --- a/arch/arm/include/asm/arch-tegra20/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h @@ -243,9 +243,6 @@ struct usb_ctlr { #define VBUS_VLD_STS (1 26) -/* Change the USB host port into host mode */ -void usb_set_host_mode(void); - /* Setup USB on the board */ int board_usb_init(const void *blob); -- 1.8.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 7/7] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]
The ehci_hcd entry points were just calling into the Tegra USB functions. Now that they are in the same file we can just move over the implementation. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/include/asm/arch-tegra/usb.h | 19 -- drivers/usb/host/ehci-tegra.c | 119 +++--- 2 files changed, 51 insertions(+), 87 deletions(-) diff --git a/arch/arm/include/asm/arch-tegra/usb.h b/arch/arm/include/asm/arch-tegra/usb.h index b18c850..ef6c089 100644 --- a/arch/arm/include/asm/arch-tegra/usb.h +++ b/arch/arm/include/asm/arch-tegra/usb.h @@ -246,23 +246,4 @@ struct usb_ctlr { /* Setup USB on the board */ int board_usb_init(const void *blob); -/** - * Start up the given port number (ports are numbered from 0 on each board). - * This returns values for the appropriate hccr and hcor addresses to use for - * USB EHCI operations. - * - * @param portnum port number to start - * @param hccr returns start address of EHCI HCCR registers - * @param hcor returns start address of EHCI HCOR registers - * @return 0 if ok, -1 on error (generally invalid port number) - */ -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor); - -/** - * Stop the current port - * - * @return 0 if ok, -1 if no port was active - */ -int tegrausb_stop_port(int portnum); - #endif /* _TEGRA_USB_H_ */ diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index b77806f..554145a 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -438,60 +438,6 @@ static void config_clock(const u32 timing[]) timing[PARAM_CPCON], timing[PARAM_LFCON]); } -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct fdt_usb *config; - struct usb_ctlr *usbctlr; - - if (portnum = port_count) - return -1; - - config = port[portnum]; - - /* skip init, if the port is already initialized */ - if (config-initialized) - goto success; - - if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - set_host_mode(config); - - config-initialized = 1; - -success: - usbctlr = config-reg; - *hccr = (u32)usbctlr-cap_length; - *hcor = (u32)usbctlr-usb_cmd; - return 0; -} - -int tegrausb_stop_port(int portnum) -{ - struct usb_ctlr *usbctlr; - - usbctlr = port[portnum].reg; - - /* Stop controller */ - writel(0, usbctlr-usb_cmd); - udelay(1000); - - /* Initiate controller reset */ - writel(2, usbctlr-usb_cmd); - udelay(1000); - - port[portnum].initialized = 0; - - return 0; -} - int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -576,32 +522,69 @@ int board_usb_init(const void *blob) return 0; } -/* - * Create the appropriate control structures to manage - * a new EHCI host controller. +/** + * Start up the given port number (ports are numbered from 0 on each board). + * This returns values for the appropriate hccr and hcor addresses to use for + * USB EHCI operations. + * + * @param indexport number to start + * @param hccr returns start address of EHCI HCCR registers + * @param hcor returns start address of EHCI HCOR registers + * @return 0 if ok, -1 on error (generally invalid port number) */ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - u32 our_hccr, our_hcor; + struct fdt_usb *config; + struct usb_ctlr *usbctlr; - /* -* Select the first port, as we don't have a way of selecting others -* yet -*/ - if (tegrausb_start_port(index, our_hccr, our_hcor)) + if (index = port_count) + return -1; + + config = port[index]; + + /* skip init, if the port is already initialized */ + if (config-initialized) + goto success; + + if (config-utmi init_utmi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); + return -1; + } + + if (config-ulpi init_ulpi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); return -1; + } - *hccr = (struct ehci_hccr *)our_hccr; - *hcor = (struct ehci_hcor *)our_hcor; + set_host_mode(config); + + config-initialized = 1; +success: + usbctlr = config-reg; + *hccr = (struct ehci_hccr *)usbctlr-cap_length; + *hcor = (struct ehci_hcor *)usbctlr-usb_cmd; return 0; } /* - * Destroy the appropriate control structures corresponding
[U-Boot] [PATCH v3 6/7] tegra: usb: move implementation into right directory
This moves the Tegra USB implementation into the drivers/usb/host directory. Note that this merges the old /arch/arm/cpu/armv7/tegra20/usb.c file into ehci-tegra.c. No code changes, just moving stuff around. v2: While at it also move some defines and the usb.h header file to make usb driver usable for Tegra30. NOTE: A lot more work is required to properly init the PHYs and PLL_U on Tegra30, this is just to make porting easier and it does no harm here. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/Makefile | 1 - arch/arm/cpu/armv7/tegra20/usb.c | 555 -- arch/arm/include/asm/arch-tegra/usb.h | 268 +++ arch/arm/include/asm/arch-tegra20/tegra.h | 1 - arch/arm/include/asm/arch-tegra20/usb.h | 268 --- arch/arm/include/asm/arch-tegra30/tegra.h | 2 + board/nvidia/common/board.c | 2 +- drivers/usb/host/ehci-tegra.c | 535 +++- 8 files changed, 804 insertions(+), 828 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra20/usb.c create mode 100644 arch/arm/include/asm/arch-tegra/usb.h delete mode 100644 arch/arm/include/asm/arch-tegra20/usb.h diff --git a/arch/arm/cpu/armv7/tegra20/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile index 54ed8c4..c8a8504 100644 --- a/arch/arm/cpu/armv7/tegra20/Makefile +++ b/arch/arm/cpu/armv7/tegra20/Makefile @@ -27,7 +27,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o COBJS-$(CONFIG_PWM_TEGRA) += pwm.o COBJS-$(CONFIG_VIDEO_TEGRA) += display.o diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c deleted file mode 100644 index 3fdd5df..000 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.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 asm/io.h -#include asm-generic/gpio.h -#include asm/arch/clock.h -#include asm/arch/usb.h -#include usb/ulpi.h -#include libfdt.h -#include fdtdec.h - -#ifdef CONFIG_USB_ULPI - #ifndef CONFIG_USB_ULPI_VIEWPORT - #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ - define CONFIG_USB_ULPI_VIEWPORT - #endif -#endif - -enum { - USB_PORTS_MAX = 3,/* Maximum ports we allow */ -}; - -/* Parameters we need for USB */ -enum { - PARAM_DIVN, /* PLL FEEDBACK DIVIDer */ - PARAM_DIVM, /* PLL INPUT DIVIDER */ - PARAM_DIVP, /* POST DIVIDER (2^N) */ - PARAM_CPCON,/* BASE PLLC CHARGE Pump setup ctrl */ - PARAM_LFCON,/* BASE PLLC LOOP FILter setup ctrl */ - PARAM_ENABLE_DELAY_COUNT, /* PLL-U Enable Delay Count */ - PARAM_STABLE_COUNT, /* PLL-U STABLE count */ - PARAM_ACTIVE_DELAY_COUNT, /* PLL-U Active delay count */ - PARAM_XTAL_FREQ_COUNT, /* PLL-U XTAL frequency count */ - PARAM_DEBOUNCE_A_TIME, /* 10MS DELAY for BIAS_DEBOUNCE_A */ - PARAM_BIAS_TIME,/* 20US DELAY AFter bias cell op */ - - PARAM_COUNT -}; - -/* Possible port types (dual role mode) */ -enum dr_mode { - DR_MODE_NONE = 0, - DR_MODE_HOST, /* supports host operation */ - DR_MODE_DEVICE, /* supports device operation */ - DR_MODE_OTG,/* supports both */ -}; - -/* Information about a USB port */ -struct fdt_usb { - struct usb_ctlr *reg; /* address of registers in physical memory */ - unsigned utmi:1;/* 1 if port has external tranceiver, else 0 */ - unsigned ulpi:1;/* 1 if port has external ULPI transceiver */ - unsigned enabled:1; /* 1 to enable, 0 to disable */ - unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */ - unsigned initialized:1; /* has this port already been initialized? */ - enum dr_mode dr_mode; /* dual role mode */ - enum periph_id periph_id
Re: [U-Boot] CONFIG_DELAY_ENVIRONMENT usage
Hi Allen, Am Dienstag, den 29.01.2013, 19:05 -0800 schrieb Allen Martin: The problem I'm seeing is that this regressed environment loading on all boards that use fdt, because none of them have /config/load-environment defined. If I read the commit message correctly, I think the actual intention is: static int should_load_env(void) { #ifdef CONFIG_DELAY_ENVIRONMENT #ifdef CONFIG_OF_CONTROL return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0); #else return 0; #endif #else return 1; #endif } There is already a patch for that on the mailing list. See http://www.mail-archive.com/u-boot@lists.denx.de/msg103841.html We agreed that just swapping around the default value for the FDT case is the right thing to do. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/7] tegra: usb: set USB_PORTS_MAX to correct value
Both Tegra20 and Tegra30 have a max of 3 USB controllers. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..f151fb2 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -44,7 +44,7 @@ #endif enum { - USB_PORTS_MAX = 4,/* Maximum ports we allow */ + USB_PORTS_MAX = 3,/* Maximum ports we allow */ }; /* Parameters we need for USB */ -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 0/7] Move Tegra EHCI drive to correct place
This moves out the Tegra EHCI driver from a platform specific directory to the standard driver/usb/host dir. This is a preparation needed to share this driver between Tegra20 and Tegra30. No functional change in here, so Tegra30 is still not working. Patch 6 could be a lot smaller if it were generated with -B, as GIT would detect that most of it is moving stuff over, but last time I did this it prevented git apply to work. So sorry for the big diff. I think I incorporated all changes needed to reflect the review feedback I got on this last time. I expect this series to go in through the Tegra tree. Lucas Stach (7): tegra: usb: set USB_PORTS_MAX to correct value tegra: usb: make controller init functions more self contained tegra: usb: remove unneeded function parameter tegra: usb: move controller init into start_port tegra: usb: various small cleanups tegra: usb: move implementation into right directory tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop] arch/arm/cpu/armv7/tegra20/Makefile| 1 - arch/arm/cpu/armv7/tegra20/usb.c | 567 - .../include/asm/{arch-tegra20 = arch-tegra}/usb.h | 22 - arch/arm/include/asm/arch-tegra20/tegra.h | 1 - arch/arm/include/asm/arch-tegra30/tegra.h | 2 + board/nvidia/common/board.c| 2 +- drivers/usb/host/ehci-tegra.c | 546 +++- 7 files changed, 533 insertions(+), 608 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra20/usb.c rename arch/arm/include/asm/{arch-tegra20 = arch-tegra}/usb.h (89%) -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/7] tegra: usb: make controller init functions more self contained
There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own. Signed-off-by: Lucas Stach d...@lynxeye.de --- To clarify why this is a good thing an excerpt from the first round of review: The intent of this patch is not really to save up on parameters passed, but to make it possible to later move out the controller initialization into the ehci_hcd_init function without having to save away this global state for later use[,thus avoid bloating the file global state]. --- arch/arm/cpu/armv7/tegra20/usb.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index f151fb2..07c1ade 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -198,11 +198,12 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) } /* set up the UTMI USB controller with the parameters provided */ -static int init_utmi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr, const u32 timing[]) +static int init_utmi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; + const unsigned *timing; + struct usb_ctlr *usbctlr = config-reg; clock_enable(config-periph_id); @@ -229,6 +230,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config, * PLL Delay CONFIGURATION settings. The following parameters control * the bring up of the plls. */ + timing = usb_pll[clock_get_osc_freq()]; + val = readl(usbctlr-utmip_misc_cfg1); clrsetbits_le32(val, UTMIP_PLLU_STABLE_COUNT_MASK, timing[PARAM_STABLE_COUNT] UTMIP_PLLU_STABLE_COUNT_SHIFT); @@ -331,12 +334,12 @@ static int init_utmi_usb_controller(struct fdt_usb *config, #endif /* set up the ULPI USB controller with the parameters provided */ -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; struct ulpi_viewport ulpi_vp; + struct usb_ctlr *usbctlr = config-reg; /* set up ULPI reference clock on pllp_out4 */ clock_enable(PERIPH_ID_DEV2_OUT); @@ -408,8 +411,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config, return 0; } #else -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { printf(No code to set up ULPI controller, please enable CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT); @@ -430,22 +432,20 @@ static void config_clock(const u32 timing[]) * @param config USB port configuration * @return 0 if ok, -1 if error (too many ports) */ -static int add_port(struct fdt_usb *config, const u32 timing[]) +static int add_port(struct fdt_usb *config) { - struct usb_ctlr *usbctlr = config-reg; - if (port_count == USB_PORTS_MAX) { printf(tegrausb: Cannot register more than %d ports\n, USB_PORTS_MAX); return -1; } - if (config-utmi init_utmi_usb_controller(config, usbctlr, timing)) { + if (config-utmi init_utmi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } - if (config-ulpi init_ulpi_usb_controller(config, usbctlr)) { + if (config-ulpi init_ulpi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } @@ -558,7 +558,7 @@ int board_usb_init(const void *blob) return -1; } - if (add_port(config, usb_pll[freq])) + if (add_port(config)) return -1; set_host_mode(config); } -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 4/7] tegra: usb: move controller init into start_port
There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: - remember if port is already initialized and skip init in that case --- arch/arm/cpu/armv7/tegra20/usb.c | 57 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 2007483..e4165e0 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -79,6 +79,7 @@ struct fdt_usb { unsigned ulpi:1;/* 1 if port has external ULPI transceiver */ unsigned enabled:1; /* 1 to enable, 0 to disable */ unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */ + unsigned initialized:1; /* has this port already been initialized? */ enum dr_mode dr_mode; /* dual role mode */ enum periph_id periph_id;/* peripheral id */ struct fdt_gpio_state vbus_gpio;/* GPIO for vbus enable */ @@ -426,44 +427,36 @@ static void config_clock(const u32 timing[]) timing[PARAM_CPCON], timing[PARAM_LFCON]); } -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) { - if (port_count == USB_PORTS_MAX) { - printf(tegrausb: Cannot register more than %d ports\n, - USB_PORTS_MAX); + struct fdt_usb *config; + struct usb_ctlr *usbctlr; + + if (portnum = port_count) return -1; - } + + config = port[portnum]; + + /* skip init, if the port is already initialized */ + if (config-initialized) + goto success; if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } - port[port_count++] = *config; - - return 0; -} - -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct usb_ctlr *usbctlr; + set_host_mode(config); - if (portnum = port_count) - return -1; - set_host_mode(port[portnum]); + config-initialized = 1; - usbctlr = port[portnum].reg; +success: + usbctlr = config-reg; *hccr = (u32)usbctlr-cap_length; *hcor = (u32)usbctlr-usb_cmd; return 0; @@ -483,6 +476,8 @@ int tegrausb_stop_port(int portnum) writel(2, usbctlr-usb_cmd); udelay(1000); + port[portnum].initialized = 0; + return 0; } @@ -546,6 +541,12 @@ int board_usb_init(const void *blob) count = fdtdec_find_aliases_for_id(blob, usb, COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX); for (i = 0; i count; i++) { + if (port_count == USB_PORTS_MAX) { + printf(tegrausb: Cannot register more than %d ports\n, + USB_PORTS_MAX); + return -1; + } + debug(USB %d: , i); node = node_list[i]; if (!node) @@ -555,10 +556,10 @@ int board_usb_init(const void *blob) fdt_get_name(blob, node, NULL)); return -1; } + config.initialized = 0; - if (add_port(config)) - return -1; - set_host_mode(config); + /* add new USB port to the list of available ports */ + port[port_count++] = config; } return 0; -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 6/7] tegra: usb: move implementation into right directory
This moves the Tegra USB implementation into the drivers/usb/host directory. Note that this merges the old /arch/arm/cpu/armv7/tegra20/usb.c file into ehci-tegra.c. No code changes, just moving stuff around. v2: While at it also move some defines and the usb.h header file to make usb driver usable for Tegra30. NOTE: A lot more work is required to properly init the PHYs and PLL_U on Tegra30, this is just to make porting easier and it does no harm here. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/Makefile| 1 - arch/arm/cpu/armv7/tegra20/usb.c | 555 - .../include/asm/{arch-tegra20 = arch-tegra}/usb.h | 0 arch/arm/include/asm/arch-tegra20/tegra.h | 1 - arch/arm/include/asm/arch-tegra30/tegra.h | 2 + board/nvidia/common/board.c| 2 +- drivers/usb/host/ehci-tegra.c | 535 +++- 7 files changed, 536 insertions(+), 560 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra20/usb.c rename arch/arm/include/asm/{arch-tegra20 = arch-tegra}/usb.h (100%) diff --git a/arch/arm/cpu/armv7/tegra20/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile index 54ed8c4..c8a8504 100644 --- a/arch/arm/cpu/armv7/tegra20/Makefile +++ b/arch/arm/cpu/armv7/tegra20/Makefile @@ -27,7 +27,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o COBJS-$(CONFIG_PWM_TEGRA) += pwm.o COBJS-$(CONFIG_VIDEO_TEGRA) += display.o diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c deleted file mode 100644 index 3fdd5df..000 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.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 asm/io.h -#include asm-generic/gpio.h -#include asm/arch/clock.h -#include asm/arch/usb.h -#include usb/ulpi.h -#include libfdt.h -#include fdtdec.h - -#ifdef CONFIG_USB_ULPI - #ifndef CONFIG_USB_ULPI_VIEWPORT - #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ - define CONFIG_USB_ULPI_VIEWPORT - #endif -#endif - -enum { - USB_PORTS_MAX = 3,/* Maximum ports we allow */ -}; - -/* Parameters we need for USB */ -enum { - PARAM_DIVN, /* PLL FEEDBACK DIVIDer */ - PARAM_DIVM, /* PLL INPUT DIVIDER */ - PARAM_DIVP, /* POST DIVIDER (2^N) */ - PARAM_CPCON,/* BASE PLLC CHARGE Pump setup ctrl */ - PARAM_LFCON,/* BASE PLLC LOOP FILter setup ctrl */ - PARAM_ENABLE_DELAY_COUNT, /* PLL-U Enable Delay Count */ - PARAM_STABLE_COUNT, /* PLL-U STABLE count */ - PARAM_ACTIVE_DELAY_COUNT, /* PLL-U Active delay count */ - PARAM_XTAL_FREQ_COUNT, /* PLL-U XTAL frequency count */ - PARAM_DEBOUNCE_A_TIME, /* 10MS DELAY for BIAS_DEBOUNCE_A */ - PARAM_BIAS_TIME,/* 20US DELAY AFter bias cell op */ - - PARAM_COUNT -}; - -/* Possible port types (dual role mode) */ -enum dr_mode { - DR_MODE_NONE = 0, - DR_MODE_HOST, /* supports host operation */ - DR_MODE_DEVICE, /* supports device operation */ - DR_MODE_OTG,/* supports both */ -}; - -/* Information about a USB port */ -struct fdt_usb { - struct usb_ctlr *reg; /* address of registers in physical memory */ - unsigned utmi:1;/* 1 if port has external tranceiver, else 0 */ - unsigned ulpi:1;/* 1 if port has external ULPI transceiver */ - unsigned enabled:1; /* 1 to enable, 0 to disable */ - unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */ - unsigned initialized:1; /* has this port already been initialized? */ - enum dr_mode dr_mode; /* dual role mode */ - enum periph_id periph_id;/* peripheral id */ - struct fdt_gpio_state vbus_gpio;/* GPIO for vbus enable */ - struct fdt_gpio_state
[U-Boot] [PATCH v2 3/7] tegra: usb: remove unneeded function parameter
Just a dead parameter, never actually used. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Simon Glass s...@chromium.org --- arch/arm/cpu/armv7/tegra20/usb.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 07c1ade..2007483 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -486,8 +486,7 @@ int tegrausb_stop_port(int portnum) return 0; } -int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, - struct fdt_usb *config) +int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -535,7 +534,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, int board_usb_init(const void *blob) { struct fdt_usb config; - unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC); enum clock_osc_freq freq; int node_list[USB_PORTS_MAX]; int node, count, i; @@ -552,7 +550,7 @@ int board_usb_init(const void *blob) node = node_list[i]; if (!node) continue; - if (fdt_decode_usb(blob, node, osc_freq, config)) { + if (fdt_decode_usb(blob, node, config)) { debug(Cannot decode USB node %s\n, fdt_get_name(blob, node, NULL)); return -1; -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 5/7] tegra: usb: various small cleanups
Remove unneeded headers, function prototype and stale comment, that doesn't match the actual codebase anymore. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c| 13 + arch/arm/include/asm/arch-tegra20/usb.h | 3 --- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index e4165e0..3fdd5df 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -25,21 +25,15 @@ #include asm/io.h #include asm-generic/gpio.h #include asm/arch/clock.h -#include asm/arch/gpio.h -#include asm/arch/pinmux.h -#include asm/arch/tegra.h #include asm/arch/usb.h #include usb/ulpi.h -#include asm/arch-tegra/clk_rst.h -#include asm/arch-tegra/sys_proto.h -#include asm/arch-tegra/uart.h #include libfdt.h #include fdtdec.h #ifdef CONFIG_USB_ULPI #ifndef CONFIG_USB_ULPI_VIEWPORT #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ - define CONFIG_USB_ULPI_VIEWPORT + define CONFIG_USB_ULPI_VIEWPORT #endif #endif @@ -191,11 +185,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) /* Enable the UTMIP PHY */ if (config-utmi) setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB); - - /* -* TODO: where do we take the USB1 out of reset? The old code would -* take USB3 out of reset, but not USB1. This code doesn't do either. -*/ } /* set up the UTMI USB controller with the parameters provided */ diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h index fdbd127..b18c850 100644 --- a/arch/arm/include/asm/arch-tegra20/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h @@ -243,9 +243,6 @@ struct usb_ctlr { #define VBUS_VLD_STS (1 26) -/* Change the USB host port into host mode */ -void usb_set_host_mode(void); - /* Setup USB on the board */ int board_usb_init(const void *blob); -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 7/7] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]
The ehci_hcd entry points were just calling into the Tegra USB functions. Now that they are in the same file we can just move over the implementation. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/include/asm/arch-tegra/usb.h | 19 -- drivers/usb/host/ehci-tegra.c | 119 +++--- 2 files changed, 51 insertions(+), 87 deletions(-) diff --git a/arch/arm/include/asm/arch-tegra/usb.h b/arch/arm/include/asm/arch-tegra/usb.h index b18c850..ef6c089 100644 --- a/arch/arm/include/asm/arch-tegra/usb.h +++ b/arch/arm/include/asm/arch-tegra/usb.h @@ -246,23 +246,4 @@ struct usb_ctlr { /* Setup USB on the board */ int board_usb_init(const void *blob); -/** - * Start up the given port number (ports are numbered from 0 on each board). - * This returns values for the appropriate hccr and hcor addresses to use for - * USB EHCI operations. - * - * @param portnum port number to start - * @param hccr returns start address of EHCI HCCR registers - * @param hcor returns start address of EHCI HCOR registers - * @return 0 if ok, -1 on error (generally invalid port number) - */ -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor); - -/** - * Stop the current port - * - * @return 0 if ok, -1 if no port was active - */ -int tegrausb_stop_port(int portnum); - #endif /* _TEGRA_USB_H_ */ diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index b77806f..13bd6cc 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -438,60 +438,6 @@ static void config_clock(const u32 timing[]) timing[PARAM_CPCON], timing[PARAM_LFCON]); } -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct fdt_usb *config; - struct usb_ctlr *usbctlr; - - if (portnum = port_count) - return -1; - - config = port[portnum]; - - /* skip init, if the port is already initialized */ - if (config-initialized) - goto success; - - if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - set_host_mode(config); - - config-initialized = 1; - -success: - usbctlr = config-reg; - *hccr = (u32)usbctlr-cap_length; - *hcor = (u32)usbctlr-usb_cmd; - return 0; -} - -int tegrausb_stop_port(int portnum) -{ - struct usb_ctlr *usbctlr; - - usbctlr = port[portnum].reg; - - /* Stop controller */ - writel(0, usbctlr-usb_cmd); - udelay(1000); - - /* Initiate controller reset */ - writel(2, usbctlr-usb_cmd); - udelay(1000); - - port[portnum].initialized = 0; - - return 0; -} - int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -576,32 +522,69 @@ int board_usb_init(const void *blob) return 0; } -/* - * Create the appropriate control structures to manage - * a new EHCI host controller. +/** + * Start up the given port number (ports are numbered from 0 on each board). + * This returns values for the appropriate hccr and hcor addresses to use for + * USB EHCI operations. + * + * @param indexport number to start + * @param hccr returns start address of EHCI HCCR registers + * @param hcor returns start address of EHCI HCOR registers + * @return 0 if ok, -1 on error (generally invalid port number) */ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - u32 our_hccr, our_hcor; + struct fdt_usb *config; + struct usb_ctlr *usbctlr; - /* -* Select the first port, as we don't have a way of selecting others -* yet -*/ - if (tegrausb_start_port(index, our_hccr, our_hcor)) + if (index = port_count) + return -1; + + config = port[index]; + + /* skip init, if the port is already initialized */ + if (config-initialized) + goto success; + + if (config-utmi init_utmi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); + return -1; + } + + if (config-ulpi init_ulpi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); return -1; + } + + set_host_mode(config); - *hccr = (struct ehci_hccr *)our_hccr; - *hcor = (struct ehci_hcor *)our_hcor; + config-initialized = 1; +success: + usbctlr = config-reg; + *hccr = (u32)usbctlr-cap_length; + *hcor = (u32)usbctlr-usb_cmd; return 0; } /* - * Destroy the appropriate control structures corresponding - * the the EHCI host controller. + * Bring down the specified USB
Re: [U-Boot] [PATCH v2 0/7] Move Tegra EHCI drive to correct place
Hello Tom, Am Freitag, den 25.01.2013, 08:07 -0800 schrieb Tom Warren: I tried to apply this to u-boot-tegra/next and it needed some massaging to get it to apply cleanly. Minor stuff, but you'll need to rebase it on top of current u-boot-tegra/next (I just pushed a new version with my 'Move common clock code' patch and Allen's fix for the DTS sort patch. Sorry, but the Tegra repo is going to be fairly dynamic for the next few weeks. Ok, I'll wait for some comments on the actual code, then repost a rebased version. Also, when I did get it applied and tried to ./MAKEALL -s tegra20 -s tegra30, I got the following warning on all T20 builds: ehci-tegra.c: In function 'ehci_hcd_init': ehci-tegra.c:565: warning: assignment makes pointer from integer without a cast ehci-tegra.c:566: warning: assignment makes pointer from integer without a cast Ah damn, forgot to squash the fix in the last patch. Also, it appears that arch-tegra20/usb.h is still hanging around (in my edited patch series, at any rate). Shouldn't the moved arch-tegra/usb.h be used exclusively? Removing arch-tegra20/usb.h causes fatal errors in nvidia/common/board.c. If it does need to exist, then it needs to live in arch-tegra30, also, so it'll be available when T30 gets USB turned on. I don't see why this is happening. The shortlog points at git picking up the rename at the in the wrong dir, I'll look into this when reposting. But the change to nvidia/common/board.c to use the new include dir is definitely included in patch 6. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 06/11] tegra20: switch over seaboard and ventana to use tablebased pinmux
Hello Simon, Am Samstag, den 26.01.2013, 10:20 +1300 schrieb Simon Glass: Hi Lucas, On Fri, Jan 25, 2013 at 7:22 AM, Lucas Stach d...@lynxeye.de wrote: Am Freitag, den 25.01.2013, 06:54 +1300 schrieb Simon Glass: Hi Lucas, On Fri, Jan 25, 2013 at 5:48 AM, Lucas Stach d...@lynxeye.de wrote: Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/seaboard/seaboard.c | 133 +-- include/configs/seaboard.h | 3 + include/configs/ventana.h| 3 + 3 files changed, 121 insertions(+), 18 deletions(-) This seems like a lot of code and presumably quite a bit of duplication between boards. What sort of conflicts does this avoid, and is it the only way of avoiding them? I don't see it as duplication, but as explicitly spelling out how the pinmux configuration should be set up on a certain board. I mean that the table is very similar for different boards, so looks like duplicated coded (133 very similar lines for each board). Also, this seems to break FDT use. At present it is possible (I think) to boot the same U-Boot on any board, with the device tree specifying the config. With your change that is no longer possible, I think? Looking ahead to T114 I see a similar problem. The funcmux approach was a compromise in that we could just select appropriate values for each function - there was no agreement on how to put this in the FDT though (my intention was that it would depend on the kernel binding, but that is now defined, so what excuse do we have for not implementing it in U-Boot?). That Tegra30 doesn't do so either. ;) But I agree, that's no valid excuse and we should resolve this before Tegra114 introduces more of this stuff. See below. Before this change we would leave some pads uninitialised in their (random) reset configuration. For example on the Colibri this leads to NAND not working as it's wired up to the KBC pads. If we only configure those, ATC will remain in it's reset state and would be also configured to the NAND function, which leads to fail. Having an explicit, known to be conflict free configuration for all pads avoids all those unpleasant surprises. Well yes, but we seem to be right back to where we started, with the FDT unable to describe a key feature of the boards (pinmux). I see your point now. The obvious answer for now is: it's not regressing functionality, as we were never able to boot the same U-Boot image by just changing the DT. But yes in the end we want to pack this information into the DT files. But even then it would be nice if people would test this pachset, as I imagine DT based pinmux is the same as tablebased pinmux, just in a slightly different flavour. ;) So if people test the tablebased config now, we can do the conversion to DT based with a lot more confidence. I'll look into using the kernel pinmux binding minus the MUX stuff, as I think there's no real reason to have this in U-Boot. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 06/11] tegra20: switch over seaboard and ventana to use tablebased pinmux
Am Samstag, den 26.01.2013, 10:49 +1300 schrieb Simon Glass: [...] But yes in the end we want to pack this information into the DT files. But even then it would be nice if people would test this pachset, as I imagine DT based pinmux is the same as tablebased pinmux, just in a slightly different flavour. ;) So if people test the tablebased config now, we can do the conversion to DT based with a lot more confidence. I'll look into using the kernel pinmux binding minus the MUX stuff, as I think there's no real reason to have this in U-Boot. Well I would rather than we get that running than switch to table-driven mux, assuming it is not too big a job? I imagine perhaps naively that a function could be written which parses the pinmux and sets it up in U-Boot - effectively using the FDT as the pinmux table. That's my plan. But still even if we keep the binding the same, the actual pinmux config would differ between the kernel and U-Boot (a lot more pads kept in tristate in U-Boot). So as the FDT would effectively resemble the same tables I included in this patchset, some testing coverage of that would smoothen the transition. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 04/11] tegra20: switch over tamonten platform to use tablebased pinmux
Am Freitag, den 25.01.2013, 14:04 -0800 schrieb Stephen Warren: On 01/24/2013 08:48 AM, Lucas Stach wrote: Init pinmux in one shot, in order to avoid any conflicts. diff --git a/board/avionic-design/common/tamonten.c b/board/avionic-design/common/tamonten.c +static struct pingroup_config tamonten_pinmux[] = { + PINMUX_ENTRY(ATA, IDE, NORMAL, NORMAL), /* GPIO */ + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* MMC */ ... I believe this initializes every single pingroup on the SoC to something. In order to prevent any behavior changes, wouldn't it be better to first fill in this table only with entries that achieve the same pinmux programming that used to be performed by the C code you're removing? Then, a separate later patch could fill in missing items in the pinmux table. I think that'd end up being much safer and easier to validate. As I wrote in the cover letter this initializes the pinmux to the same values the Linux kernel uses. I don't consider it a safer approach to pull out the old pinmux from the C Code and then later building a conflict free full muxtable out of this. However I made sure to go through the C Code to see which pads need to be un-tristated. At that time I cross-checked the table with the functions used by the C Code. But as a human I'm not safe from mistakes. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 10/11] tegra20: remove old pinmux setup
Am Freitag, den 25.01.2013, 14:12 -0800 schrieb Stephen Warren: On 01/24/2013 08:48 AM, Lucas Stach wrote: All boards are converted to the new tablebased pinmux setup. Get rid of the old method. diff --git a/arch/arm/cpu/tegra-common/board.c b/arch/arm/cpu/tegra-common/board.c @@ -145,7 +121,6 @@ static void setup_uarts(int uart_ids) if (uart_ids (1 i)) { enum periph_id id = id_for_uart[i]; - funcmux_select(id, uart_configs[i]); clock_ll_start_uart(id); } } Doesn't the debug UART get set up very early, in the SPL, before any table-based pinmux could be activated? If so, I think we need to leave this one funcmux API call in place, so that the debug UART always works nice and early. If not, how much does this series increase the binary of the SPL? Ah right, I forgot about SPL debug. If we go for FDT based pinmux, we have to init UART in some explicit way, as DT and SPL don't mix. But even then I would like to get rid of the funcmux style and rather let the boards provide a minimal UART pinmux init table, as funcmux doesn't map too well onto the plethora of config options Tegra30 provides for the pinmux. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 00/11] tablebased pinmux for Tegra20
This series introduces tablebased pinmux to all Tegra20 boards and removes the old way of doing pinmux to avoid any possible conflicts in pin setup. Patch 1 introduces a temporary CONFIG option for the new pinmux style to avoid breaking bisectability in the middle of the series. This option gets removed again in patch 10. I have verified that all commits build without errors and tested the new pinmux on my Colibri T20 platform. For all other boards I took the pinmux configuration from the Linux kernel, but only un-tristated the pads that are used by U-Boot. I can't test the other boards myself, so please everyone with the hardware give this a run and provide a tested-by or a bug report. The series is based denx.de/u-boot-tegra/next. Patch 11 is more of a RFC and removes the old funcmux as after the switchover nothing uses it anymore. We are not doing real muxing in U-Boot, so there is no need to keep it. But I want to hear from other people if they see any reason to keep this. Lucas Stach (11): tegra: introduce config option to do table based pinmux tegra20: add entry point and helper for tablebased pinmux tegra20: switch over colibri_t20 board to use tablebased pinmux tegra20: switch over tamonten platform to use tablebased pinmux tegra20: switch over harmony board to use tablebased pinmux tegra20: switch over seaboard and ventana to use tablebased pinmux tegra20: switch over whistler board to use tablebased pinmux tegra20: switch over paz00 board to use tablebased pinmux tegra20: switch over trimslice board to use tablebased pinmux tegra20: remove old pinmux setup tegra20: remove funcmux arch/arm/cpu/tegra-common/board.c | 26 -- arch/arm/cpu/tegra20-common/Makefile | 2 +- arch/arm/cpu/tegra20-common/funcmux.c | 310 - arch/arm/include/asm/arch-tegra/board.h| 12 - arch/arm/include/asm/arch-tegra20/funcmux.h| 67 - arch/arm/include/asm/arch-tegra20/pinmux.h | 12 + board/avionic-design/common/tamonten.c | 133 +++-- board/compal/paz00/paz00.c | 149 +++--- board/compulab/trimslice/trimslice.c | 146 +++--- board/nvidia/common/board.c| 36 +-- board/nvidia/harmony/harmony.c | 143 -- board/nvidia/seaboard/seaboard.c | 133 +++-- board/nvidia/whistler/whistler.c | 131 - .../colibri_t20-common/colibri_t20-common.c| 132 +++-- board/toradex/colibri_t20_iris/colibri_t20_iris.c | 16 +- drivers/i2c/tegra_i2c.c| 9 - drivers/input/tegra-kbc.c | 4 +- drivers/mtd/nand/tegra_nand.c | 1 - drivers/video/tegra.c | 3 - include/configs/colibri_t20_iris.h | 1 - include/configs/trimslice.h| 1 - include/configs/whistler.h | 1 - 22 files changed, 814 insertions(+), 654 deletions(-) delete mode 100644 arch/arm/cpu/tegra20-common/funcmux.c delete mode 100644 arch/arm/include/asm/arch-tegra20/funcmux.h -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/11] tegra: introduce config option to do table based pinmux
This disables all pinmux entry points and instead calls pinmux_init() in early board init, allowing boards to set up the pinmux in one shot, like it's done with Tegra30. This option is temporary and can go away once we switched over all boards to the new pinmux style. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/common/board.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index a4af539..d9d0e59 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -132,7 +132,9 @@ int board_init(void) gpio_config_uart(); #endif #ifdef CONFIG_TEGRA_SPI +#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX pin_mux_spi(); +#endif spi_init(); #endif #ifdef CONFIG_PWM_TEGRA @@ -140,7 +142,9 @@ int board_init(void) debug(%s: Failed to init pwm\n, __func__); #endif #ifdef CONFIG_LCD +#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX pin_mux_display(); +#endif tegra_lcd_check_next_stage(gd-fdt_blob, 0); #endif /* boot param addr */ @@ -165,14 +169,16 @@ int board_init(void) #endif /* CONFIG_TEGRA_I2C */ #ifdef CONFIG_USB_EHCI_TEGRA +#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX pin_mux_usb(); +#endif board_usb_init(gd-fdt_blob); #endif #ifdef CONFIG_LCD tegra_lcd_check_next_stage(gd-fdt_blob, 0); #endif -#ifdef CONFIG_TEGRA_NAND +#if defined(CONFIG_TEGRA_NAND) !defined(CONFIG_TEGRA_TABLEBASED_PINMUX) pin_mux_nand(); #endif @@ -196,7 +202,7 @@ void gpio_early_init(void) __attribute__((weak, alias(__gpio_early_init))); int board_early_init_f(void) { -#if defined(CONFIG_TEGRA30) +#if defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA_TABLEBASED_PINMUX) pinmux_init(); #endif board_init_uart_f(); -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/11] tegra20: add entry point and helper for tablebased pinmux
Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/include/asm/arch-tegra20/pinmux.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/include/asm/arch-tegra20/pinmux.h b/arch/arm/include/asm/arch-tegra20/pinmux.h index a9b4eda..a167e48 100644 --- a/arch/arm/include/asm/arch-tegra20/pinmux.h +++ b/arch/arm/include/asm/arch-tegra20/pinmux.h @@ -350,4 +350,16 @@ void pinmux_set_tristate(enum pmux_pingrp pin, int enable); */ void pinmux_config_table(const struct pingroup_config *config, int len); +/* Set a group of pins from a table */ +void pinmux_init(void); + +/* helper to fill pinmux table */ +#define PINMUX_ENTRY(_pingroup, _mux, _pull, _tri) \ + { \ + .pingroup = PINGRP_##_pingroup, \ + .func = PMUX_FUNC_##_mux, \ + .pull = PMUX_PULL_##_pull,\ + .tristate = PMUX_TRI_##_tri, \ + } + #endif /* PINMUX_H */ -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/11] tegra20: switch over tamonten platform to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/avionic-design/common/tamonten.c | 133 - include/configs/medcom-wide.h | 3 + include/configs/plutux.h | 3 + include/configs/tec.h | 3 + 4 files changed, 125 insertions(+), 17 deletions(-) diff --git a/board/avionic-design/common/tamonten.c b/board/avionic-design/common/tamonten.c index e6a932e..f072407 100644 --- a/board/avionic-design/common/tamonten.c +++ b/board/avionic-design/common/tamonten.c @@ -3,6 +3,8 @@ * NVIDIA Corporation www.nvidia.com * (C) Copyright 2011-2012 * Avionic Design GmbH www.avionic-design.de + * (C) Copyright 2013 + * Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -28,7 +30,6 @@ #include asm/io.h #include asm/gpio.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch/tegra.h #include asm/arch-tegra/board.h @@ -50,28 +51,126 @@ void gpio_early_init(void) #endif #ifdef CONFIG_TEGRA_MMC -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); - /* for write-protect GPIO PI6 */ - pinmux_tristate_disable(PINGRP_ATA); - /* for CD GPIO PH2 */ - pinmux_tristate_disable(PINGRP_ATD); -} - /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - /* init dev 0, SD slot, with 4-bit bus */ tegra_mmc_init(0, 4, GPIO_PI6, GPIO_PH2); return 0; } #endif + +static struct pingroup_config tamonten_pinmux[] = { + PINMUX_ENTRY(ATA, IDE, NORMAL, NORMAL), /* GPIO */ + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* MMC */ + PINMUX_ENTRY(ATC, NAND, NORMAL, TRISTATE), + PINMUX_ENTRY(ATD, GMI, NORMAL, NORMAL), /* GPIO */ + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, TRISTATE), + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* MMC */ + PINMUX_ENTRY(GMB, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMC, UARTD, NORMAL, NORMAL), /* UART D */ + PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* MMC */ + PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, TRISTATE), + PINMUX_ENTRY(IRRX, UARTA, NORMAL, TRISTATE), + PINMUX_ENTRY(IRTX, UARTA, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCB, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCD, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(LCSN, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD14, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD15, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD16, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD17, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LDC, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LDI, DISPA, NORMAL
[U-Boot] [PATCH 03/11] tegra20: switch over colibri_t20 board to use tablebased pinmux
Init Colibri T20 pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- .../colibri_t20-common/colibri_t20-common.c| 132 + board/toradex/colibri_t20_iris/colibri_t20_iris.c | 16 +-- include/configs/colibri_t20_iris.h | 3 + 3 files changed, 115 insertions(+), 36 deletions(-) diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.c b/board/toradex/colibri_t20-common/colibri_t20-common.c index 6d5e47d..e5163f3 100644 --- a/board/toradex/colibri_t20-common/colibri_t20-common.c +++ b/board/toradex/colibri_t20-common/colibri_t20-common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Lucas Stach + * Copyright (C) 2012-2013 Lucas Stach * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -14,31 +14,121 @@ */ #include common.h -#include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch-tegra/board.h #include colibri_t20-common.h -#ifdef CONFIG_USB_EHCI_TEGRA -void colibri_t20_common_pin_mux_usb(void) -{ - /* module internal USB bus to connect ethernet chipset */ - funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); - /* ULPI reference clock output */ - pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); - pinmux_tristate_disable(PINGRP_CDEV2); - /* PHY reset GPIO */ - pinmux_tristate_disable(PINGRP_UAC); - /* VBus GPIO */ - pinmux_tristate_disable(PINGRP_DTE); -} -#endif +static struct pingroup_config colibri_t20_pinmux[] = { + PINMUX_ENTRY(ATA, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* MMC */ + PINMUX_ENTRY(ATC, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, NORMAL), /* ULPI REFCLK */ + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, RSVD1, NORMAL, NORMAL), /* GPIO */ + PINMUX_ENTRY(DTF, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* MMC */ + PINMUX_ENTRY(GMB, IDE, NORMAL, NORMAL), /* GPIO */ + PINMUX_ENTRY(GMC, UARTD, NORMAL, NORMAL), /* UART D */ + PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* MMC 8bit */ + PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, NORMAL), + PINMUX_ENTRY(IRRX, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(IRTX, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCA, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(KBCB, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(KBCC, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(KBCD, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(KBCE, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(KBCF, NAND, NORMAL, NORMAL), /* NAND */ + PINMUX_ENTRY(LCSN,RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD14, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD15, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD16, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD17, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LDC, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(LDI, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LHP0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LHP1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LHP2, DISPA
[U-Boot] [PATCH 05/11] tegra20: switch over harmony board to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/harmony/harmony.c | 143 - include/configs/harmony.h | 3 + 2 files changed, 116 insertions(+), 30 deletions(-) diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c index 93430ed..f6dc709 100644 --- a/board/nvidia/harmony/harmony.c +++ b/board/nvidia/harmony/harmony.c @@ -1,6 +1,8 @@ /* * (C) Copyright 2010,2011 * NVIDIA Corporation www.nvidia.com + * (C) Copyright 2013 + * Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -24,7 +26,6 @@ #include common.h #include asm/io.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch/tegra.h #include asm/arch-tegra/mmc.h @@ -35,34 +36,11 @@ #ifdef CONFIG_TEGRA_MMC -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); - funcmux_select(PERIPH_ID_SDMMC2, FUNCMUX_SDMMC2_DTA_DTD_8BIT); - - /* For power GPIO PI6 */ - pinmux_tristate_disable(PINGRP_ATA); - /* For CD GPIO PH2 */ - pinmux_tristate_disable(PINGRP_ATD); - - /* For power GPIO PT3 */ - pinmux_tristate_disable(PINGRP_DTB); - /* For CD GPIO PI5 */ - pinmux_tristate_disable(PINGRP_ATC); -} - /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { debug(board_mmc_init called\n); - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - debug(board_mmc_init: init SD slot J26\n); /* init dev 0, SD slot J26, with 8-bit bus */ tegra_mmc_init(0, 8, GPIO_PI6, GPIO_PH2); @@ -75,11 +53,116 @@ int board_mmc_init(bd_t *bd) } #endif -void pin_mux_usb(void) +static struct pingroup_config harmony_pinmux[] = { + PINMUX_ENTRY(ATA, IDE, NORMAL, NORMAL), /* GPIO PI6*/ + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATC, NAND, NORMAL, NORMAL), /* NAND, GPIO PI5 */ + PINMUX_ENTRY(ATD, GMI, NORMAL, NORMAL), /* GPIO PH2 */ + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, NORMAL), /* ULPI REFCLK */ + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, SDIO2, NORMAL, NORMAL), /* SDMMC2 */ + PINMUX_ENTRY(DTB, RSVD1, NORMAL, NORMAL), /* GPIO PT3 */ + PINMUX_ENTRY(DTC, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, SDIO2, NORMAL, NORMAL), /* SDMMC2 */ + PINMUX_ENTRY(DTE, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GMB, GMI, NORMAL, NORMAL), /* GPIO PC7 */ + PINMUX_ENTRY(GMC, UARTD, NORMAL, NORMAL), /* UART D */ + PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU7, RTCK, NORMAL, TRISTATE), + PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, TRISTATE), + PINMUX_ENTRY(IRRX, UARTA, NORMAL, NORMAL), /* UART A */ + PINMUX_ENTRY(IRTX, UARTA, NORMAL, NORMAL), /* UART A */ + PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCB, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCD, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(LCSN, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD14, DISPA, NORMAL
[U-Boot] [PATCH 07/11] tegra20: switch over whistler board to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/whistler/whistler.c | 131 ++- include/configs/whistler.h | 3 + 2 files changed, 119 insertions(+), 15 deletions(-) diff --git a/board/nvidia/whistler/whistler.c b/board/nvidia/whistler/whistler.c index 592cd6b..56f066e 100644 --- a/board/nvidia/whistler/whistler.c +++ b/board/nvidia/whistler/whistler.c @@ -1,6 +1,8 @@ /* * (C) Copyright 2010-2012 * NVIDIA Corporation www.nvidia.com + * (C) Copyright 2013 + * Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -25,7 +27,6 @@ #include asm/io.h #include asm/arch/tegra.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch-tegra/mmc.h #include asm/gpio.h @@ -34,17 +35,6 @@ #include mmc.h #endif - -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT); - funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT); -} - /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { @@ -70,9 +60,6 @@ int board_mmc_init(bd_t *bd) if (ret) printf(i2c_write 0 0x3c 0x44 failed: %d\n, ret); - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - /* init dev 0 (SDMMC4), (J29 HSMMC) with 8-bit bus */ tegra_mmc_init(0, 8, -1, -1); @@ -107,3 +94,117 @@ void pin_mux_usb(void) if (ret) printf(i2c_write 0 0x20 6 failed: %d\n, ret); } + +static struct pingroup_config whistler_pinmux[] = { + PINMUX_ENTRY(ATA, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATB, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATC, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATD, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, OSC, NORMAL, TRISTATE), + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMB, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMC, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, DAP5, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, NORMAL), /* DVC */ + PINMUX_ENTRY(IRRX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(IRTX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCB, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCD, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(LCSN, SPI3, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD14, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD15, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD16, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD17, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LDC, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LDI, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LHP0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LHP1, DISPA, NORMAL, TRISTATE
[U-Boot] [PATCH 06/11] tegra20: switch over seaboard and ventana to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/seaboard/seaboard.c | 133 +-- include/configs/seaboard.h | 3 + include/configs/ventana.h| 3 + 3 files changed, 121 insertions(+), 18 deletions(-) diff --git a/board/nvidia/seaboard/seaboard.c b/board/nvidia/seaboard/seaboard.c index 3e33da0..b5b4b31 100644 --- a/board/nvidia/seaboard/seaboard.c +++ b/board/nvidia/seaboard/seaboard.c @@ -1,6 +1,8 @@ /* * (C) Copyright 2010,2011 * NVIDIA Corporation www.nvidia.com + * (C) Copyright 2013 + * Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -25,7 +27,6 @@ #include asm/io.h #include asm/arch/tegra.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/gpio.h #include asm/arch/pinmux.h #include asm/arch-tegra/mmc.h @@ -47,29 +48,12 @@ void gpio_early_init_uart(void) #endif #ifdef CONFIG_TEGRA_MMC -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); - funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_4BIT); - - /* For power GPIO PI6 */ - pinmux_tristate_disable(PINGRP_ATA); - /* For CD GPIO PI5 */ - pinmux_tristate_disable(PINGRP_ATC); -} /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { debug(board_mmc_init called\n); - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - debug(board_mmc_init: init eMMC\n); /* init dev 0, eMMC chip, with 8-bit bus */ tegra_mmc_init(0, 8, -1, -1); @@ -87,3 +71,116 @@ void pin_mux_usb(void) /* For USB's GPIO PD0. For now, since we have no pinmux in fdt */ pinmux_tristate_disable(PINGRP_SLXK); } +static struct pingroup_config seaboard_pinmux[] = { + PINMUX_ENTRY(ATA, IDE, NORMAL, NORMAL), /* GPIO PI6 */ + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATC, NAND, NORMAL, NORMAL), /* NAND, GPIO PI5 */ + PINMUX_ENTRY(ATD, GMI, NORMAL, NORMAL), /* NAND, GPIO PH1,PH3 */ + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, TRISTATE), + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GMB, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMC, UARTD, NORMAL, NORMAL), /* UART D */ + PINMUX_ENTRY(GMD, SFLASH, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GPU, PWM, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, TRISTATE), + PINMUX_ENTRY(IRRX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(IRTX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCA, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(KBCB, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(KBCC, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(KBCD, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(KBCE, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(KBCF, KBC, UP, NORMAL), /* KBC */ + PINMUX_ENTRY(LCSN, RSVD4, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD1, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD2, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD3, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD4, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD5, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD6, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD7, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD8, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD9, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD10, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD11, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD12, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD13, DISPA, NORMAL
[U-Boot] [PATCH 08/11] tegra20: switch over paz00 board to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/compal/paz00/paz00.c | 149 ++--- include/configs/paz00.h| 3 + 2 files changed, 115 insertions(+), 37 deletions(-) diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c index 1447f47..b56ba41 100644 --- a/board/compal/paz00/paz00.c +++ b/board/compal/paz00/paz00.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013 Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -26,40 +27,11 @@ #ifdef CONFIG_TEGRA_MMC -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - /* SDMMC4: config 3, x8 on 2nd set of pins */ - pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4); - pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4); - pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4); - - pinmux_tristate_disable(PINGRP_ATB); - pinmux_tristate_disable(PINGRP_GMA); - pinmux_tristate_disable(PINGRP_GME); - - /* SDIO1: SDIO1_CLK, SDIO1_CMD, SDIO1_DAT[3:0] */ - pinmux_set_func(PINGRP_SDIO1, PMUX_FUNC_SDIO1); - - pinmux_tristate_disable(PINGRP_SDIO1); - - /* For power GPIO PV1 */ - pinmux_tristate_disable(PINGRP_UAC); - /* For CD GPIO PV5 */ - pinmux_tristate_disable(PINGRP_GPV); -} - /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { debug(board_mmc_init called\n); - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - debug(board_mmc_init: init eMMC\n); /* init dev 0, eMMC chip, with 8-bit bus */ tegra_mmc_init(0, 8, -1, -1); @@ -72,13 +44,116 @@ int board_mmc_init(bd_t *bd) } #endif -#ifdef CONFIG_LCD -/* this is a weak define that we are overriding */ -void pin_mux_display(void) -{ - debug(init display pinmux\n); +static struct pingroup_config paz00_pinmux[] = { + PINMUX_ENTRY(ATA, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATC, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, TRISTATE), + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, PLLC_OUT1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, GMI, NORMAL, NORMAL), /* GPIO PA4 */ + PINMUX_ENTRY(DAP3, DAP3, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, RSVD1, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GMB, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMC, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GMD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GME, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GPU, PWM, NORMAL, NORMAL), /* GPIO PU4 */ + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, PCIE, NORMAL, NORMAL), /* GPIO PV5 */ + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, TRISTATE), + PINMUX_ENTRY(IRRX, UARTA, NORMAL, NORMAL), /* UART A */ + PINMUX_ENTRY(IRTX, UARTA, NORMAL, NORMAL), /* UART A */ + PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCB, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCD, SDIO2, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(LCSN, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD1, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD2, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD3, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD4, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD5, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD6, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD7, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD8, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD9, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD10, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD11, DISPA, NORMAL, NORMAL), /* LCD */ + PINMUX_ENTRY(LD12, DISPA
[U-Boot] [PATCH 09/11] tegra20: switch over trimslice board to use tablebased pinmux
Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/compulab/trimslice/trimslice.c | 146 +++ include/configs/trimslice.h | 3 + 2 files changed, 118 insertions(+), 31 deletions(-) diff --git a/board/compulab/trimslice/trimslice.c b/board/compulab/trimslice/trimslice.c index 8f4dd09..9af7ca6 100644 --- a/board/compulab/trimslice/trimslice.c +++ b/board/compulab/trimslice/trimslice.c @@ -1,6 +1,8 @@ /* * (C) Copyright 2010-2012 * NVIDIA Corporation www.nvidia.com + * (C) Copyright 2013 + * Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -25,7 +27,6 @@ #include asm/io.h #include asm/arch/tegra.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch-tegra/mmc.h #include asm/gpio.h @@ -34,41 +35,11 @@ #include mmc.h #endif -void pin_mux_usb(void) -{ - /* -* USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO -* in the current device tree. -*/ - pinmux_tristate_disable(PINGRP_UAC); -} - -void pin_mux_spi(void) -{ - funcmux_select(PERIPH_ID_SPI1, FUNCMUX_SPI1_GMC_GMD); -} - -/* - * Routine: pin_mux_mmc - * Description: setup the pin muxes/tristate values for the SDMMC(s) - */ -static void pin_mux_mmc(void) -{ - funcmux_select(PERIPH_ID_SDMMC1, FUNCMUX_SDMMC1_SDIO1_4BIT); - funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); - - /* For CD GPIO PP1 */ - pinmux_tristate_disable(PINGRP_DAP3); -} - /* this is a weak define that we are overriding */ int board_mmc_init(bd_t *bd) { debug(board_mmc_init called\n); - /* Enable muxes, etc. for SDMMC controllers */ - pin_mux_mmc(); - /* init dev 0 (SDMMC4), (micro-SD slot) with 4-bit bus */ tegra_mmc_init(0, 4, -1, GPIO_PP1); @@ -77,3 +48,116 @@ int board_mmc_init(bd_t *bd) return 0; } +static struct pingroup_config trimslice_pinmux[] = { + PINMUX_ENTRY(ATA, IDE, NORMAL, TRISTATE), + PINMUX_ENTRY(ATB, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(ATC, NAND, NORMAL, TRISTATE), + PINMUX_ENTRY(ATD, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(ATE, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV1, PLLA_OUT, NORMAL, TRISTATE), + PINMUX_ENTRY(CDEV2, PLLP_OUT4, NORMAL, TRISTATE), + PINMUX_ENTRY(CRTP, CRT, NORMAL, TRISTATE), + PINMUX_ENTRY(CSUS, VI_SENSOR_CLK, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP1, DAP1, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP2, DAP2, NORMAL, TRISTATE), + PINMUX_ENTRY(DAP3, DAP3, NORMAL, NORMAL), /* GPIO PP1 */ + PINMUX_ENTRY(DAP4, DAP4, NORMAL, TRISTATE), + PINMUX_ENTRY(DDC, I2C2, NORMAL, TRISTATE), + PINMUX_ENTRY(DTA, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTB, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTC, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTD, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTE, VI, NORMAL, TRISTATE), + PINMUX_ENTRY(DTF, I2C3, NORMAL, TRISTATE), + PINMUX_ENTRY(GMA, SDIO4, NORMAL, NORMAL), /* SDMMC4 */ + PINMUX_ENTRY(GMB, NAND, NORMAL, TRISTATE), + PINMUX_ENTRY(GMC, SFLASH, NORMAL, NORMAL), /* SPI1 */ + PINMUX_ENTRY(GMD, SFLASH, NORMAL, NORMAL), /* SPI1 */ + PINMUX_ENTRY(GME, GMI, NORMAL, TRISTATE), + PINMUX_ENTRY(GPU, UARTA, NORMAL, NORMAL), /* UART A */ + PINMUX_ENTRY(GPU7, RTCK, NORMAL, NORMAL), /* JTAG RTCK */ + PINMUX_ENTRY(GPV, PCIE, NORMAL, TRISTATE), + PINMUX_ENTRY(HDINT, HDMI, NORMAL, TRISTATE), + PINMUX_ENTRY(I2CP, I2C, NORMAL, TRISTATE), + PINMUX_ENTRY(IRRX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(IRTX, UARTB, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCA, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCB, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCC, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCD, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCE, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(KBCF, KBC, NORMAL, TRISTATE), + PINMUX_ENTRY(LCSN, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD0, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD1, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD2, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD3, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD4, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD5, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD6, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD7, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD8, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD9, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD10, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD11, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD12, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD13, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD14, DISPA, NORMAL, TRISTATE), + PINMUX_ENTRY(LD15, DISPA, NORMAL, TRISTATE
[U-Boot] [PATCH 10/11] tegra20: remove old pinmux setup
All boards are converted to the new tablebased pinmux setup. Get rid of the old method. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/tegra-common/board.c | 25 arch/arm/include/asm/arch-tegra/board.h | 12 -- board/nvidia/common/board.c | 41 + drivers/i2c/tegra_i2c.c | 9 drivers/input/tegra-kbc.c | 4 +--- drivers/video/tegra.c | 3 --- include/configs/colibri_t20_iris.h | 4 include/configs/harmony.h | 3 --- include/configs/medcom-wide.h | 3 --- include/configs/paz00.h | 3 --- include/configs/plutux.h| 3 --- include/configs/seaboard.h | 3 --- include/configs/tec.h | 3 --- include/configs/trimslice.h | 4 include/configs/ventana.h | 3 --- include/configs/whistler.h | 4 16 files changed, 2 insertions(+), 125 deletions(-) diff --git a/arch/arm/cpu/tegra-common/board.c b/arch/arm/cpu/tegra-common/board.c index 1ec6c06..bb6a035 100644 --- a/arch/arm/cpu/tegra-common/board.c +++ b/arch/arm/cpu/tegra-common/board.c @@ -102,30 +102,6 @@ int checkboard(void) } #endif /* CONFIG_DISPLAY_BOARDINFO */ -static int uart_configs[] = { -#if defined(CONFIG_TEGRA20) - #if defined(CONFIG_TEGRA_UARTA_UAA_UAB) - FUNCMUX_UART1_UAA_UAB, - #elif defined(CONFIG_TEGRA_UARTA_GPU) - FUNCMUX_UART1_GPU, - #elif defined(CONFIG_TEGRA_UARTA_SDIO1) - FUNCMUX_UART1_SDIO1, - #else - FUNCMUX_UART1_IRRX_IRTX, - #endif - FUNCMUX_UART2_UARTB, - -1, - FUNCMUX_UART4_GMC, - -1, -#else /* Tegra30 */ - FUNCMUX_UART1_ULPI, /* UARTA */ - -1, - -1, - -1, - -1, -#endif -}; - /** * Set up the specified uarts * @@ -145,7 +121,6 @@ static void setup_uarts(int uart_ids) if (uart_ids (1 i)) { enum periph_id id = id_for_uart[i]; - funcmux_select(id, uart_configs[i]); clock_ll_start_uart(id); } } diff --git a/arch/arm/include/asm/arch-tegra/board.h b/arch/arm/include/asm/arch-tegra/board.h index 3db0d93..fffd55e 100644 --- a/arch/arm/include/asm/arch-tegra/board.h +++ b/arch/arm/include/asm/arch-tegra/board.h @@ -34,16 +34,4 @@ void board_init_uart_f(void); /* Set up any early GPIOs the board might need for proper operation */ void gpio_early_init(void); /* overrideable GPIO config*/ -/* - * Hooks to allow boards to set up the pinmux for a specific function. - * Has to be implemented in the board files as we don't yet support pinmux - * setup from FTD. If a board file does not implement one of those functions - * an empty stub function will be called. - */ - -void pin_mux_usb(void); /* overrideable USB pinmux setup */ -void pin_mux_spi(void); /* overrideable SPI pinmux setup */ -void pin_mux_nand(void); /* overrideable NAND pinmux setup*/ -void pin_mux_display(void); /* overrideable DISPLAY pinmux setup */ - #endif diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index d9d0e59..c76791c 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -69,18 +69,6 @@ int timer_init(void) } #endif -void __pin_mux_usb(void) -{ -} - -void pin_mux_usb(void) __attribute__((weak, alias(__pin_mux_usb))); - -void __pin_mux_spi(void) -{ -} - -void pin_mux_spi(void) __attribute__((weak, alias(__pin_mux_spi))); - void __gpio_early_init_uart(void) { } @@ -88,19 +76,6 @@ void __gpio_early_init_uart(void) void gpio_early_init_uart(void) __attribute__((weak, alias(__gpio_early_init_uart))); -void __pin_mux_nand(void) -{ - funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT); -} - -void pin_mux_nand(void) __attribute__((weak, alias(__pin_mux_nand))); - -void __pin_mux_display(void) -{ -} - -void pin_mux_display(void) __attribute__((weak, alias(__pin_mux_display))); - /* * Routine: power_det_init * Description: turn off power detects @@ -132,9 +107,6 @@ int board_init(void) gpio_config_uart(); #endif #ifdef CONFIG_TEGRA_SPI -#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX - pin_mux_spi(); -#endif spi_init(); #endif #ifdef CONFIG_PWM_TEGRA @@ -142,9 +114,6 @@ int board_init(void) debug(%s: Failed to init pwm\n, __func__); #endif #ifdef CONFIG_LCD -#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX - pin_mux_display(); -#endif tegra_lcd_check_next_stage(gd-fdt_blob, 0); #endif /* boot param addr */ @@ -169,19 +138,12 @@ int board_init(void) #endif /* CONFIG_TEGRA_I2C */ #ifdef CONFIG_USB_EHCI_TEGRA -#ifndef CONFIG_TEGRA_TABLEBASED_PINMUX - pin_mux_usb(); -#endif board_usb_init(gd-fdt_blob); #endif #ifdef CONFIG_LCD tegra_lcd_check_next_stage(gd-fdt_blob, 0); #endif -#if defined
[U-Boot] [PATCH 11/11] tegra20: remove funcmux
It's not used by anything anymore, now that all boards are using tablebased pinmux. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/tegra-common/board.c | 1 - arch/arm/cpu/tegra20-common/Makefile| 2 +- arch/arm/cpu/tegra20-common/funcmux.c | 310 arch/arm/include/asm/arch-tegra20/funcmux.h | 67 -- board/nvidia/common/board.c | 1 - drivers/mtd/nand/tegra_nand.c | 1 - 6 files changed, 1 insertion(+), 381 deletions(-) delete mode 100644 arch/arm/cpu/tegra20-common/funcmux.c delete mode 100644 arch/arm/include/asm/arch-tegra20/funcmux.h diff --git a/arch/arm/cpu/tegra-common/board.c b/arch/arm/cpu/tegra-common/board.c index bb6a035..073da3a 100644 --- a/arch/arm/cpu/tegra-common/board.c +++ b/arch/arm/cpu/tegra-common/board.c @@ -24,7 +24,6 @@ #include common.h #include asm/io.h #include asm/arch/clock.h -#include asm/arch/funcmux.h #include asm/arch/tegra.h #include asm/arch-tegra/board.h #include asm/arch-tegra/pmc.h diff --git a/arch/arm/cpu/tegra20-common/Makefile b/arch/arm/cpu/tegra20-common/Makefile index 8184e5e..142786f 100644 --- a/arch/arm/cpu/tegra20-common/Makefile +++ b/arch/arm/cpu/tegra20-common/Makefile @@ -31,7 +31,7 @@ CFLAGS_arch/arm/cpu/tegra20-common/warmboot_avp.o += -march=armv4t LIB= $(obj)lib$(SOC)-common.o -COBJS-y+= clock.o funcmux.o pinmux.o +COBJS-y+= clock.o pinmux.o COBJS-$(CONFIG_TEGRA_LP0) += warmboot.o crypto.o warmboot_avp.o COBJS-$(CONFIG_TEGRA_CLOCK_SCALING) += emc.o COBJS-$(CONFIG_TEGRA_PMU) += pmu.o diff --git a/arch/arm/cpu/tegra20-common/funcmux.c b/arch/arm/cpu/tegra20-common/funcmux.c deleted file mode 100644 index a1c55a6..000 --- a/arch/arm/cpu/tegra20-common/funcmux.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. - * 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 - */ - -/* Tegra20 high-level function multiplexing */ -#include common.h -#include asm/arch/clock.h -#include asm/arch/funcmux.h -#include asm/arch/pinmux.h - -/* - * The PINMUX macro is used to set up pinmux tables. - */ -#define PINMUX(grp, mux, pupd, tri) \ - {PINGRP_##grp, PMUX_FUNC_##mux, PMUX_PULL_##pupd, PMUX_TRI_##tri} - -static const struct pingroup_config disp1_default[] = { - PINMUX(LDI, DISPA, NORMAL,NORMAL), - PINMUX(LHP0, DISPA, NORMAL,NORMAL), - PINMUX(LHP1, DISPA, NORMAL,NORMAL), - PINMUX(LHP2, DISPA, NORMAL,NORMAL), - PINMUX(LHS, DISPA, NORMAL,NORMAL), - PINMUX(LM0, RSVD4, NORMAL,NORMAL), - PINMUX(LPP, DISPA, NORMAL,NORMAL), - PINMUX(LPW0, DISPA, NORMAL,NORMAL), - PINMUX(LPW2, DISPA, NORMAL,NORMAL), - PINMUX(LSC0, DISPA, NORMAL,NORMAL), - PINMUX(LSPI, DISPA, NORMAL,NORMAL), - PINMUX(LVP1, DISPA, NORMAL,NORMAL), - PINMUX(LVS, DISPA, NORMAL,NORMAL), - PINMUX(SLXD, SPDIF, NORMAL,NORMAL), -}; - - -int funcmux_select(enum periph_id id, int config) -{ - int bad_config = config != FUNCMUX_DEFAULT; - - switch (id) { - case PERIPH_ID_UART1: - switch (config) { - case FUNCMUX_UART1_IRRX_IRTX: - pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA); - pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA); - pinmux_tristate_disable(PINGRP_IRRX); - pinmux_tristate_disable(PINGRP_IRTX); - break; - case FUNCMUX_UART1_UAA_UAB: - pinmux_set_func(PINGRP_UAA, PMUX_FUNC_UARTA); - pinmux_set_func(PINGRP_UAB, PMUX_FUNC_UARTA); - pinmux_tristate_disable(PINGRP_UAA); - pinmux_tristate_disable(PINGRP_UAB); - bad_config = 0; - break; - case FUNCMUX_UART1_GPU: - pinmux_set_func(PINGRP_GPU, PMUX_FUNC_UARTA); - pinmux_tristate_disable(PINGRP_GPU); - bad_config = 0
Re: [U-Boot] [PATCH 06/11] tegra20: switch over seaboard and ventana to use tablebased pinmux
Am Freitag, den 25.01.2013, 06:54 +1300 schrieb Simon Glass: Hi Lucas, On Fri, Jan 25, 2013 at 5:48 AM, Lucas Stach d...@lynxeye.de wrote: Init pinmux in one shot, in order to avoid any conflicts. Signed-off-by: Lucas Stach d...@lynxeye.de --- board/nvidia/seaboard/seaboard.c | 133 +-- include/configs/seaboard.h | 3 + include/configs/ventana.h| 3 + 3 files changed, 121 insertions(+), 18 deletions(-) This seems like a lot of code and presumably quite a bit of duplication between boards. What sort of conflicts does this avoid, and is it the only way of avoiding them? I don't see it as duplication, but as explicitly spelling out how the pinmux configuration should be set up on a certain board. Before this change we would leave some pads uninitialised in their (random) reset configuration. For example on the Colibri this leads to NAND not working as it's wired up to the KBC pads. If we only configure those, ATC will remain in it's reset state and would be also configured to the NAND function, which leads to fail. Having an explicit, known to be conflict free configuration for all pads avoids all those unpleasant surprises. Also, how does this deal with drivers that want to support different configurations, such as 4/8 bit MMC, UART flow control, etc.? How does this fit with what the device tree pinmux specifies in the kernel, and why would we not move to using that? This is just the pinmux. You have to make sure to match the pinmux with your driver configuration. This tablebased approach is the same thing as what is done with Tegra30 in U-Boot. It's not as runtime flexible as the pinmux used in the Linux kernel, but also quite a fair bit simpler. I don't see any platform that would need anything other than the default configuration in U-Boot, so we don't need the muxing stuff provided by the pinmux framework in the kernel. While running U-Boot we want to keep most of the pads in tristate and just enable the ones used by U-Boot itself (boot devices, GPIOs, LCD pins, etc.), so using the plain kernel pinmux config isn't going to work. So I think the table based approach is a good compromise between the need of having an comprehensively defined pinmux, simplicity and effort needed to define the pinmux. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] arm: fix CONFIG_DELAY_ENVIRONMENT to act like it claims in the README
No one expects to end up in a delayed environment if CONFIG_DELAY_ENVIRONMENT isn't defined. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: keep preference of CONFIG_OF_CONTROL and just change default value --- arch/arm/lib/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index cfe32cc..9f861cc 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -488,7 +488,7 @@ static char *failed = *** failed ***\n; static int should_load_env(void) { #ifdef CONFIG_OF_CONTROL - return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0); + return fdtdec_get_config_int(gd-fdt_blob, load-environment, 1); #elif defined CONFIG_DELAY_ENVIRONMENT return 0; #else -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] tegra: pinmux: fix FUNCMUX_NDFLASH_KBC_8_BIT
Am Dienstag, den 22.01.2013, 09:24 -0700 schrieb Stephen Warren: On 01/21/2013 05:20 PM, Lucas Stach wrote: Even the 8bit case needs KBCB configured, as pin D7 is located in this pingroup. Also pingroup ATC seems to come out of reset with config set to NAND, so we need to explictly configure some other function to this group in order to avoid clashing settings. diff --git a/arch/arm/cpu/tegra20-common/funcmux.c b/arch/arm/cpu/tegra20-common/funcmux.c @@ -266,17 +266,25 @@ int funcmux_select(enum periph_id id, int config) break; case FUNCMUX_NDFLASH_KBC_8_BIT: ... + /* +* configure pingroup ATC to something unrelated to +* avoid ATC overriding KBC +*/ + pinmux_set_func(PINGRP_ATC, PMUX_FUNC_GMI); + This gets a bit dangerous; what if pingroup ATC was already configured for some function other than NAND or GMI? This code will then break that setting. I would suggest one of the following alternatives: 1) Use the new pinmux_avoid_func() function implemented in the patch that I just sent. 2) Move Tegra20 over to the new board-wide pinmux style that Tegra30 uses, where the entire pinmux is initialized in one shot. This will completely avoid any kind of uninitialized pinmux settings, and to some extent is the only sensible thing to do on a device like Tegra which has the potential for conflicts like this patch tries to avoid. I'll take a look on how much work it is to implement option #2. If it isn't too much and I find some time in this U-Boot release cycle, I'm very much inclined to do this the ultimately right way. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] tegra: pinmux: fix FUNCMUX_NDFLASH_KBC_8_BIT
Even the 8bit case needs KBCB configured, as pin D7 is located in this pingroup. Also pingroup ATC seems to come out of reset with config set to NAND, so we need to explictly configure some other function to this group in order to avoid clashing settings. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/tegra20-common/funcmux.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/cpu/tegra20-common/funcmux.c b/arch/arm/cpu/tegra20-common/funcmux.c index a1c55a6..30fdf1c 100644 --- a/arch/arm/cpu/tegra20-common/funcmux.c +++ b/arch/arm/cpu/tegra20-common/funcmux.c @@ -266,17 +266,25 @@ int funcmux_select(enum periph_id id, int config) break; case FUNCMUX_NDFLASH_KBC_8_BIT: pinmux_set_func(PINGRP_KBCA, PMUX_FUNC_NAND); + pinmux_set_func(PINGRP_KBCB, PMUX_FUNC_NAND); pinmux_set_func(PINGRP_KBCC, PMUX_FUNC_NAND); pinmux_set_func(PINGRP_KBCD, PMUX_FUNC_NAND); pinmux_set_func(PINGRP_KBCE, PMUX_FUNC_NAND); pinmux_set_func(PINGRP_KBCF, PMUX_FUNC_NAND); pinmux_tristate_disable(PINGRP_KBCA); + pinmux_tristate_disable(PINGRP_KBCB); pinmux_tristate_disable(PINGRP_KBCC); pinmux_tristate_disable(PINGRP_KBCD); pinmux_tristate_disable(PINGRP_KBCE); pinmux_tristate_disable(PINGRP_KBCF); + /* +* configure pingroup ATC to something unrelated to +* avoid ATC overriding KBC +*/ + pinmux_set_func(PINGRP_ATC, PMUX_FUNC_GMI); + bad_config = 0; break; } -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] arm: fix CONFIG_DELAY_ENVIRONMENT to act like it claims in the README
No one expects to end up in a delayed environment if CONFIG_DELAY_ENVIRONMENT isn't defined. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/lib/board.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index cfe32cc..1a32611 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -487,10 +487,12 @@ static char *failed = *** failed ***\n; */ static int should_load_env(void) { +#ifdef CONFIG_DELAY_ENVIRONMENT #ifdef CONFIG_OF_CONTROL return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0); -#elif defined CONFIG_DELAY_ENVIRONMENT +#else return 0; +#endif #else return 1; #endif -- 1.8.0.2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/10] arm: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading
Am Donnerstag, den 01.11.2012, 16:42 -0700 schrieb Simon Glass: This option delays loading of the environment until later, so that only the default environment will be available to U-Boot. This can address the security risk of untrusted data being used during boot. When CONFIG_DELAY_ENVIRONMENT is defined, it is convenient to have a run-time way of enabling loadinlg of the environment. Add this to the fdt as /config/delay-environment. It's really unfortunate to only realize this after the final release of v2013.01 as I haven't tested the -rc3, but this breaks environment for almost all Tegra boards. I haven't checked all of them, but the ones I looked at have CONFIG_OF_CONTROL defined, but no load-environment node in the FDT. So they're all going straight into secure boot mode, because of the bogus standard value of not allowing env to load, which is probably not what most people want. Regards, Lucas --- [...] /* - + * Tell if it's OK to load the environment early in boot. + * + * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see + * if this is OK (defaulting to saying it's not OK). + * + * NOTE: Loading the environment early can be a bad idea if security is + * important, since no verification is done on the environment. + * + * @return 0 if environment should not be loaded, !=0 if it is ok to load + */ +static int should_load_env(void) +{ +#ifdef CONFIG_OF_CONTROL + return fdtdec_get_config_int(gd-fdt_blob, load-environment, 0); +#elif defined CONFIG_DELAY_ENVIRONMENT + return 0; +#else + return 1; +#endif +} + [...] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 7/7] Tegra30: Add/enable Cardhu build (T30 reference board)
Hi Tom, Am Dienstag, den 04.12.2012, 13:22 -0700 schrieb Tom Warren: [...] +#define V_NS16550_CLK21600 /* 216MHz (pllp_out0) */ I thought PLL_P ran at 408MHz on Tegra30? The kernel certainly sets it up that way. See my previous reply. In the internal U-Boot repo I ported from, PLLP was initially set to 216MHz, then sped up to 408MHz. When this first round of patches is in, I can address going to 408MHz first thing. Is running the PLL_P at 408MHz something which requires a lot of work? If not, please do this and fold it into this patchset. It doesn't look too nice adding things to upstream which have to be changed/removed immediately after going in. Considering that Tegra 30 support is still not really in a usable state after this patchset and the time left until things have to get ready for the next merge window, I suppose you could do it the right way from the start. 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 Marek Vasut, Am Mittwoch, den 07.11.2012, 14:25 +0100 schrieb Marek Vasut: Dear Lucas Stach, Dear Marek Vasut, Am Dienstag, den 06.11.2012, 23:35 +0100 schrieb Marek Vasut: 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. Hm ... thinking about it, maybe you can do generic USB Pdata which would contain the controller # and additional pdata (like mmap address etc). 2. For every controller that U-Boot really uses we activate host mode and do the real hardware initialisation at ehci_hcd_init time. Good. 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. Yes, but you don't pass such data through the driver (yet). You need to do that and that's what I asked you to do. We do pass this data to the driver in the form of gd-fdt_blob. This data is driver (not controller) specific, so why would you pass this in at ehci_hcd_init time? But while writing this I think I now see why we miss each others point: the Tegra EHCI driver is only instantiated once and used for all controllers. This probably has to be reworked for the driver model. Now I would still argue that we should keep the two step init model, first we instantiate the driver with some form of pdata (we can certainly come up with a one-struct-fits-all for this) and later when we are really going to use one specific controller we do the real hardware init. Now we seem to differ about the meaning of the usb stack functions. From your mails I see that you want ehci_hcd_init as the first init step where we instantiate the driver (and therefore need the pdata), where I treated it as the second step, because currently it is the point where the upper USB stack levels indicate that they are going to use a specific controller. We should probably come up with some consensus about this before going forward. Sadly my free time is really limited right now, so it's hard for me to keep up even with things I planned to do in the next few weeks, not to speak about playing around with the driver model. 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 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] usb: ehci: Take advantage of the new multi-controller feature for MXC
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. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
Am Freitag, den 02.11.2012, 08:45 -0600 schrieb Stephen Warren: On 11/01/2012 05:34 PM, Lucas Stach wrote: Am Donnerstag, den 01.11.2012, 17:30 -0600 schrieb Stephen Warren: On 11/01/2012 05:17 PM, Lucas Stach wrote: Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? I don't know, I think it's fine. It's certainly this way in the kernel. And for all I know, this GPIO does actually affect VBUS as well as flipping any mux (and the more I think about that, the more likely it is) although I can't actually know for sure since I don't have the schematics. If it's really triggering VBUS I'm fine with this, but then the comment in pin_mux_usb() is a bit off. Sorry, I don't see anything inaccurate about it. What's wrong? In which way is it masquerades as a VBUS GPIO? If it triggers VBUS it _is_ a VBUS GPIO. So the comment should rather state that switching on VBUS also muxes the port to the internal bridge. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 6/6] tegra: Enable NAND on Seaboard
Am Donnerstag, den 01.11.2012, 15:57 -0600 schrieb Stephen Warren: On 07/30/2012 12:53 AM, Simon Glass wrote: This enables NAND support for the Seaboard. diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h #include tegra20-common-post.h +/* NAND support */ +#define CONFIG_CMD_NAND +#define CONFIG_TEGRA_NAND + +/* Max number of NAND devices */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 + +/* Somewhat oddly, the NAND base address must be a config option */ +#define CONFIG_SYS_NAND_BASE TEGRA20_NAND_BASE Simon, I just noticed that all these config options are added after the include of tegra20-common-post.h. That file should be included at the very end in case it needs to do something different based on the board-specific configuration. I don't suppose you could move those lines before the include? Also CONFIG_SYS_NAND_BASE is not really used in the current Tegra nand controller codebase, in fact you can get away with not defining it. We should probably use this define in our driver code, but then we should add this define to some common Tegra place and not to individual board files. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? Signed-off-by: Stephen Warren swar...@nvidia.com --- board/compulab/dts/tegra20-trimslice.dts |3 ++- board/compulab/trimslice/trimslice.c |8 include/configs/trimslice.h |1 + 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/board/compulab/dts/tegra20-trimslice.dts b/board/compulab/dts/tegra20-trimslice.dts index db79e77..4450674 100644 --- a/board/compulab/dts/tegra20-trimslice.dts +++ b/board/compulab/dts/tegra20-trimslice.dts @@ -8,6 +8,7 @@ aliases { usb0 = /usb@c5008000; + usb1 = /usb@c500; }; memory { @@ -48,7 +49,7 @@ }; usb@c500 { - status = disabled; + nvidia,vbus-gpio = gpio 170 0; /* PV2 */ }; usb@c5004000 { diff --git a/board/compulab/trimslice/trimslice.c b/board/compulab/trimslice/trimslice.c index 9ef66fd..8f4dd09 100644 --- a/board/compulab/trimslice/trimslice.c +++ b/board/compulab/trimslice/trimslice.c @@ -34,6 +34,14 @@ #include mmc.h #endif +void pin_mux_usb(void) +{ + /* + * USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO + * in the current device tree. + */ + pinmux_tristate_disable(PINGRP_UAC); +} void pin_mux_spi(void) { diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h index eeb0dbe..165bc73 100644 --- a/include/configs/trimslice.h +++ b/include/configs/trimslice.h @@ -80,6 +80,7 @@ #define CONFIG_ENV_OFFSET(512 * 1024) /* USB Host support */ +#define CONFIG_USB_MAX_CONTROLLER_COUNT 3 #define CONFIG_USB_EHCI #define CONFIG_USB_EHCI_TEGRA #define CONFIG_USB_STORAGE ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: tegra: TrimSlice: add support for USB1 port
Am Donnerstag, den 01.11.2012, 17:30 -0600 schrieb Stephen Warren: On 11/01/2012 05:17 PM, Lucas Stach wrote: Hi Stephen, Am Donnerstag, den 01.11.2012, 16:14 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com TrimSlice's USB1 port has two purposes; it either acts as a device port hosting Tegra's USB recovery protocol, or acts as a host port connected to the internal USB-SATA bridge chip, which may in turn be connected to an SSD or HDD. Add the appropriate device tree and board configuration options to enable this port as a host port, and route the port to the SATA bridge using the VBUS GPIO. Hm, I don't really like to abuse the VBUS GPIO for this function. As the GPIO controlled routing is more a sort of pinmux can't you just add the GPIO enable to pin_mux_usb()? I don't know, I think it's fine. It's certainly this way in the kernel. And for all I know, this GPIO does actually affect VBUS as well as flipping any mux (and the more I think about that, the more likely it is) although I can't actually know for sure since I don't have the schematics. If it's really triggering VBUS I'm fine with this, but then the comment in pin_mux_usb() is a bit off. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define
No point in having this as an enum. Also while at it set it to the real hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more USB controllers we can always bump the limit then. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 4 +--- 1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..9fd1edc 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -43,9 +43,7 @@ #endif #endif -enum { - USB_PORTS_MAX = 4,/* Maximum ports we allow */ -}; +#define USB_PORTS_MAX 3 /* Maximum ports we allow */ /* Parameters we need for USB */ enum { -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained
There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 24 1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 9fd1edc..1725cd1 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -196,11 +196,12 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) } /* set up the UTMI USB controller with the parameters provided */ -static int init_utmi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr, const u32 timing[]) +static int init_utmi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; + u32 *timing; + struct usb_ctlr *usbctlr = config-reg; clock_enable(config-periph_id); @@ -227,6 +228,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config, * PLL Delay CONFIGURATION settings. The following parameters control * the bring up of the plls. */ + timing = usb_pll[clock_get_osc_freq()]; + val = readl(usbctlr-utmip_misc_cfg1); clrsetbits_le32(val, UTMIP_PLLU_STABLE_COUNT_MASK, timing[PARAM_STABLE_COUNT] UTMIP_PLLU_STABLE_COUNT_SHIFT); @@ -329,12 +332,12 @@ static int init_utmi_usb_controller(struct fdt_usb *config, #endif /* set up the ULPI USB controller with the parameters provided */ -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; struct ulpi_viewport ulpi_vp; + struct usb_ctlr *usbctlr = config-reg; /* set up ULPI reference clock on pllp_out4 */ clock_enable(PERIPH_ID_DEV2_OUT); @@ -406,8 +409,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config, return 0; } #else -static int init_ulpi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr) +static int init_ulpi_usb_controller(struct fdt_usb *config) { printf(No code to set up ULPI controller, please enable CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT); @@ -428,22 +430,20 @@ static void config_clock(const u32 timing[]) * @param config USB port configuration * @return 0 if ok, -1 if error (too many ports) */ -static int add_port(struct fdt_usb *config, const u32 timing[]) +static int add_port(struct fdt_usb *config) { - struct usb_ctlr *usbctlr = config-reg; - if (port_count == USB_PORTS_MAX) { printf(tegrausb: Cannot register more than %d ports\n, USB_PORTS_MAX); return -1; } - if (config-utmi init_utmi_usb_controller(config, usbctlr, timing)) { + if (config-utmi init_utmi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } - if (config-ulpi init_ulpi_usb_controller(config, usbctlr)) { + if (config-ulpi init_ulpi_usb_controller(config)) { printf(tegrausb: Cannot init port\n); return -1; } @@ -556,7 +556,7 @@ int board_usb_init(const void *blob) return -1; } - if (add_port(config, usb_pll[freq])) + if (add_port(config)) return -1; set_host_mode(config); } -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 6/8] tegra: usb: various small cleanups
Remove unneeded headers, function prototype and stale comment. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c| 13 + arch/arm/include/asm/arch-tegra20/usb.h | 3 --- 2 Dateien geändert, 1 Zeile hinzugefügt(+), 15 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index e372b8b..2cc95d2 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -25,21 +25,15 @@ #include asm/io.h #include asm-generic/gpio.h #include asm/arch/clock.h -#include asm/arch/gpio.h -#include asm/arch/pinmux.h -#include asm/arch/tegra.h #include asm/arch/usb.h #include usb/ulpi.h -#include asm/arch-tegra/clk_rst.h -#include asm/arch-tegra/sys_proto.h -#include asm/arch-tegra/uart.h #include libfdt.h #include fdtdec.h #ifdef CONFIG_USB_ULPI #ifndef CONFIG_USB_ULPI_VIEWPORT #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ - define CONFIG_USB_ULPI_VIEWPORT + define CONFIG_USB_ULPI_VIEWPORT #endif #endif @@ -188,11 +182,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) /* Enable the UTMIP PHY */ if (config-utmi) setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB); - - /* -* TODO: where do we take the USB1 out of reset? The old code would -* take USB3 out of reset, but not USB1. This code doesn't do either. -*/ } /* set up the UTMI USB controller with the parameters provided */ diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h index fdbd127..b18c850 100644 --- a/arch/arm/include/asm/arch-tegra20/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h @@ -243,9 +243,6 @@ struct usb_ctlr { #define VBUS_VLD_STS (1 26) -/* Change the USB host port into host mode */ -void usb_set_host_mode(void); - /* Setup USB on the board */ int board_usb_init(const void *blob); -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init
The setup is trivial, no need to split this out into a separate function. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 15 +-- 1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 1725cd1..e61bd69 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -static void config_clock(const u32 timing[]) -{ - clock_start_pll(CLOCK_ID_USB, - timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP], - timing[PARAM_CPCON], timing[PARAM_LFCON]); -} - /** * Add a new USB port to the list of available ports. * @@ -534,13 +527,15 @@ int board_usb_init(const void *blob) { struct fdt_usb config; unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC); - enum clock_osc_freq freq; int node_list[USB_PORTS_MAX]; int node, count, i; + u32 *timing; /* Set up the USB clocks correctly based on our oscillator frequency */ - freq = clock_get_osc_freq(); - config_clock(usb_pll[freq]); + timing = usb_pll[clock_get_osc_freq()]; + clock_start_pll(CLOCK_ID_USB, + timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP], + timing[PARAM_CPCON], timing[PARAM_LFCON]); /* count may return 0 on error */ count = fdtdec_find_aliases_for_id(blob, usb, -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/8] tegra: usb: remove unneeded function parameter
Just a dead parameter, never actually used. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 6 ++ 1 Datei geändert, 2 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index e61bd69..cf800b1 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -477,8 +477,7 @@ int tegrausb_stop_port(int portnum) return 0; } -int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, - struct fdt_usb *config) +int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -526,7 +525,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz, int board_usb_init(const void *blob) { struct fdt_usb config; - unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC); int node_list[USB_PORTS_MAX]; int node, count, i; u32 *timing; @@ -545,7 +543,7 @@ int board_usb_init(const void *blob) node = node_list[i]; if (!node) continue; - if (fdt_decode_usb(blob, node, osc_freq, config)) { + if (fdt_decode_usb(blob, node, config)) { debug(Cannot decode USB node %s\n, fdt_get_name(blob, node, NULL)); return -1; -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port
There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 47 +++- 1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) { - if (port_count == USB_PORTS_MAX) { - printf(tegrausb: Cannot register more than %d ports\n, - USB_PORTS_MAX); + struct fdt_usb *config; + struct usb_ctlr *usbctlr; + + if (portnum = port_count) return -1; - } + + config = port[portnum]; if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } - port[port_count++] = *config; - - return 0; -} + set_host_mode(config); -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct usb_ctlr *usbctlr; - - if (portnum = port_count) - return -1; - set_host_mode(port[portnum]); - - usbctlr = port[portnum].reg; + usbctlr = config-reg; *hccr = (u32)usbctlr-cap_length; *hcor = (u32)usbctlr-usb_cmd; return 0; @@ -539,6 +524,12 @@ int board_usb_init(const void *blob) count = fdtdec_find_aliases_for_id(blob, usb, COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX); for (i = 0; i count; i++) { + if (port_count == USB_PORTS_MAX) { + printf(tegrausb: Cannot register more than %d ports\n, + USB_PORTS_MAX); + return -1; + } + debug(USB %d: , i); node = node_list[i]; if (!node) @@ -549,9 +540,7 @@ int board_usb_init(const void *blob) return -1; } - if (add_port(config)) - return -1; - set_host_mode(config); + port[port_count++] = config; } return 0; -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 8/8] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]
The ehci_hcd entry points were just calling into the Tegra USB functions. Now that they are in the same file we can just move over the implementation. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/include/asm/arch-tegra20/usb.h | 19 --- drivers/usb/host/ehci-tegra.c | 93 + 2 Dateien geändert, 35 Zeilen hinzugefügt(+), 77 Zeilen entfernt(-) diff --git a/arch/arm/include/asm/arch-tegra20/usb.h b/arch/arm/include/asm/arch-tegra20/usb.h index b18c850..ef6c089 100644 --- a/arch/arm/include/asm/arch-tegra20/usb.h +++ b/arch/arm/include/asm/arch-tegra20/usb.h @@ -246,23 +246,4 @@ struct usb_ctlr { /* Setup USB on the board */ int board_usb_init(const void *blob); -/** - * Start up the given port number (ports are numbered from 0 on each board). - * This returns values for the appropriate hccr and hcor addresses to use for - * USB EHCI operations. - * - * @param portnum port number to start - * @param hccr returns start address of EHCI HCCR registers - * @param hcor returns start address of EHCI HCOR registers - * @return 0 if ok, -1 on error (generally invalid port number) - */ -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor); - -/** - * Stop the current port - * - * @return 0 if ok, -1 if no port was active - */ -int tegrausb_stop_port(int portnum); - #endif /* _TEGRA_USB_H_ */ diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3df43a9..5966e2d 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -426,51 +426,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) -{ - struct fdt_usb *config; - struct usb_ctlr *usbctlr; - - if (portnum = port_count) - return -1; - - config = port[portnum]; - - if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port %d\n, portnum); - return -1; - } - - set_host_mode(config); - - usbctlr = config-reg; - *hccr = (u32)usbctlr-cap_length; - *hcor = (u32)usbctlr-usb_cmd; - return 0; -} - -int tegrausb_stop_port(int portnum) -{ - struct usb_ctlr *usbctlr; - - usbctlr = port[portnum].reg; - - /* Stop controller */ - writel(0, usbctlr-usb_cmd); - udelay(1000); - - /* Initiate controller reset */ - writel(2, usbctlr-usb_cmd); - udelay(1000); - - return 0; -} - int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) { const char *phy, *mode; @@ -556,31 +511,53 @@ int board_usb_init(const void *blob) } /* - * Create the appropriate control structures to manage - * a new EHCI host controller. + * Initialize the USB controller and return the control structures. */ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - u32 our_hccr, our_hcor; + struct fdt_usb *config; + struct usb_ctlr *usbctlr; - /* -* Select the first port, as we don't have a way of selecting others -* yet -*/ - if (tegrausb_start_port(index, our_hccr, our_hcor)) + if (index = port_count) + return -1; + + config = port[index]; + + if (config-utmi init_utmi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); + return -1; + } + + if (config-ulpi init_ulpi_usb_controller(config)) { + printf(tegrausb: Cannot init port %d\n, index); return -1; + } + + set_host_mode(config); - *hccr = (struct ehci_hccr *)our_hccr; - *hcor = (struct ehci_hcor *)our_hcor; + usbctlr = config-reg; + *hccr = (struct ehci_hccr *)usbctlr-cap_length; + *hcor = (struct ehci_hcor *)usbctlr-usb_cmd; return 0; } /* - * Destroy the appropriate control structures corresponding - * the the EHCI host controller. + * Bring down the USB controller. */ int ehci_hcd_stop(int index) { - return tegrausb_stop_port(index); + struct usb_ctlr *usbctlr; + + usbctlr = port[index].reg; + + /* Stop controller */ + writel(0, usbctlr-usb_cmd); + udelay(1000); + + /* Initiate controller reset */ + writel(2, usbctlr-usb_cmd); + udelay(1000); + + return 0; } -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory
This moves the Tegra USB implementation into the drivers/usb/host directory. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/Makefile| 2 - .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 -- 2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c (92%) diff --git a/arch/arm/cpu/armv7/tegra20/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile index 09a0314..2c4d5c9 100644 --- a/arch/arm/cpu/armv7/tegra20/Makefile +++ b/arch/arm/cpu/armv7/tegra20/Makefile @@ -27,8 +27,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o - COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c similarity index 92% rename from arch/arm/cpu/armv7/tegra20/usb.c rename to drivers/usb/host/ehci-tegra.c index 2cc95d2..3df43a9 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/drivers/usb/host/ehci-tegra.c @@ -1,6 +1,7 @@ /* + * Copyright (c) 2009-2012 NVIDIA Corporation * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com + * Copyright (c) 2012 Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -21,14 +22,16 @@ * MA 02111-1307 USA */ -#include common.h #include asm/io.h -#include asm-generic/gpio.h #include asm/arch/clock.h #include asm/arch/usb.h -#include usb/ulpi.h -#include libfdt.h +#include asm-generic/gpio.h +#include common.h #include fdtdec.h +#include libfdt.h +#include usb.h +#include usb/ulpi.h +#include ehci.h #ifdef CONFIG_USB_ULPI #ifndef CONFIG_USB_ULPI_VIEWPORT @@ -138,6 +141,23 @@ static const u8 utmip_elastic_limit = 16; /* UTMIP High Speed Sync Start Delay */ static const u8 utmip_hs_sync_start_delay = 9; +/* + * A known hardware issue where Connect Status Change bit of PORTSC register + * of USB1 controller will be set after Port Reset. + * We have to clear it in order for later device enumeration to proceed. + * This ehci_powerup_fixup overrides the weak function ehci_powerup_fixup + * in ehci-hcd.c. + */ +void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg) +{ + mdelay(50); + if (((u32) status_reg TEGRA_USB_ADDR_MASK) != TEGRA_USB1_BASE) + return; + /* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ + if (ehci_readl(status_reg) EHCI_PS_CSC) + *reg |= EHCI_PS_CSC; +} + /* Put the port into host mode */ static void set_host_mode(struct fdt_usb *config) { @@ -534,3 +554,33 @@ int board_usb_init(const void *blob) return 0; } + +/* + * Create the appropriate control structures to manage + * a new EHCI host controller. + */ +int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) +{ + u32 our_hccr, our_hcor; + + /* +* Select the first port, as we don't have a way of selecting others +* yet +*/ + if (tegrausb_start_port(index, our_hccr, our_hcor)) + return -1; + + *hccr = (struct ehci_hccr *)our_hccr; + *hcor = (struct ehci_hcor *)our_hcor; + + return 0; +} + +/* + * Destroy the appropriate control structures corresponding + * the the EHCI host controller. + */ +int ehci_hcd_stop(int index) +{ + return tegrausb_stop_port(index); +} -- 1.7.11.7 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port
Hello Marek, Am Dienstag, den 30.10.2012, 11:59 +0100 schrieb Marek Vasut: Dear Lucas Stach, There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 47 +++- 1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) Fix the comment instead of removing it? I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port
Hi Marek, Am Dienstag, den 30.10.2012, 13:33 +0100 schrieb Marek Vasut: Dear Lucas Stach, [...] -static int add_port(struct fdt_usb *config) Fix the comment instead of removing it? I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory. Then add a proper comment please. Call me a docu-nazi, but I'd really love u- boot nicely and properly documented, please. I'm all in favour of adding proper documentation, but I'm opposed to add it in the middle of this cleanup/movement series. I'll send a patch on top of this series to add doc, so it doesn't interfere with the review of this series. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained
Hello Simon, Am Dienstag, den 30.10.2012, 06:03 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 24 1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-) I'm not sure I agree with the premise of this patch. At the top level it calls clock_get_osc_freq() to get the frequency. That is then passed to the two places that need it. It doesn't seem right to me to call clock_get_osc_freq() again in the lower level function just to avoid a parameter. On ARM at least a few parameters are a cheap way of passing data around. The intent of this patch is not really to save up on parameters passed, but to make it possible to later move out the controller initialization into the ehci_hcd_init function without having to save away this global state for later use. We have to init at most 2 controllers where timing matters, so I think it's the right thing to get the SoC global clock state at those two occasions to avoid inflating the file global state. It also allows the lower-level functions to deal with what they need to, rather than all functions having to reference the global state independently, each one digging down to what it actually needs. The controller init functions get passed the state only of the one port they have to initialize. There is no point in extracting things at an upper level and passing it into the functions, if it's exactly the same thing that is stored in the port state. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init
Am Dienstag, den 30.10.2012, 06:23 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: The setup is trivial, no need to split this out into a separate function. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 15 +-- 1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index 1725cd1..e61bd69 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -static void config_clock(const u32 timing[]) -{ - clock_start_pll(CLOCK_ID_USB, - timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP], - timing[PARAM_CPCON], timing[PARAM_LFCON]); -} - /** * Add a new USB port to the list of available ports. * @@ -534,13 +527,15 @@ int board_usb_init(const void *blob) { struct fdt_usb config; unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC); - enum clock_osc_freq freq; int node_list[USB_PORTS_MAX]; int node, count, i; + u32 *timing; /* Set up the USB clocks correctly based on our oscillator frequency */ - freq = clock_get_osc_freq(); - config_clock(usb_pll[freq]); + timing = usb_pll[clock_get_osc_freq()]; + clock_start_pll(CLOCK_ID_USB, + timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP], + timing[PARAM_CPCON], timing[PARAM_LFCON]); Sorry I don't see the benefit of this change. The function is there to handle a clearly-defined task, hiding the detail of clock config elsewhere. It has no effect on code generated. It's more of a personal thing, that every time there is a function call it breaks the flow when reading the code. And IMHO it's not worth the break if the called function does nothing other than just calling another function. If other people also dislike the change I may just drop it, but I would like to hear some more opinions about this first. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port
Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 47 +++- 1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) { - if (port_count == USB_PORTS_MAX) { - printf(tegrausb: Cannot register more than %d ports\n, - USB_PORTS_MAX); + struct fdt_usb *config; + struct usb_ctlr *usbctlr; + + if (portnum = port_count) return -1; - } + + config = port[portnum]; if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } - port[port_count++] = *config; - - return 0; -} + set_host_mode(config); This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time? I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a usb reset or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory
Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: This moves the Tegra USB implementation into the drivers/usb/host directory. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/Makefile| 2 - .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 -- 2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c (92%) For me this patch did not apply: Applying: tegra: usb: move implementation into right directory error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run git am --resolved. If you would prefer to skip this patch, instead run git am --skip. To restore the original branch and stop patching run git am --abort. I tried master and tegra/master. The series based on u-boot-usb/master, as it's supposed to go in through this tree. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port
Am Dienstag, den 30.10.2012, 06:48 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 6:37 AM, Lucas Stach d...@lynxeye.de wrote: Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: There is no need to init a USB controller before the upper layers indicate that they are actually going to use it. board_usb_init now only parses the device tree and sets up the common pll. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/usb.c | 47 +++- 1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config) } #endif -/** - * Add a new USB port to the list of available ports. - * - * @param config USB port configuration - * @return 0 if ok, -1 if error (too many ports) - */ -static int add_port(struct fdt_usb *config) +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor) { - if (port_count == USB_PORTS_MAX) { - printf(tegrausb: Cannot register more than %d ports\n, - USB_PORTS_MAX); + struct fdt_usb *config; + struct usb_ctlr *usbctlr; + + if (portnum = port_count) return -1; - } + + config = port[portnum]; if (config-utmi init_utmi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } if (config-ulpi init_ulpi_usb_controller(config)) { - printf(tegrausb: Cannot init port\n); + printf(tegrausb: Cannot init port %d\n, portnum); return -1; } - port[port_count++] = *config; - - return 0; -} + set_host_mode(config); This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time? I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a usb reset or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions. Perhaps, but you have to write your code in the environment that exists. At present usb_lowlevel_init() is called on every 'usb start' (and ehci_hcd_init() from that). After all this is open source and I would rather spin a patch to fix this at the right spot if we do the wrong thing, than having to cope with the bug at a lower level. Even with bug present we are not failing in any severe way, we are just wasting time bringing up a controller which is already up. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory
Am Dienstag, den 30.10.2012, 06:53 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 6:38 AM, Lucas Stach d...@lynxeye.de wrote: Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass: Hi Lucas, On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote: This moves the Tegra USB implementation into the drivers/usb/host directory. Signed-off-by: Lucas Stach d...@lynxeye.de --- arch/arm/cpu/armv7/tegra20/Makefile| 2 - .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 -- 2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c (92%) For me this patch did not apply: Applying: tegra: usb: move implementation into right directory error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run git am --resolved. If you would prefer to skip this patch, instead run git am --skip. To restore the original branch and stop patching run git am --abort. I tried master and tegra/master. The series based on u-boot-usb/master, as it's supposed to go in through this tree. OK thanks, I assumed that because tegra: was the first tag it would go through tegra. But it doesn't seem to help: git remote -v |grep upstream-usb upstream-usb http://git.denx.de/u-boot-usb.git (fetch) upstream-usb http://git.denx.de/u-boot-usb.git (push) git fetch upstream-usb From http://git.denx.de/u-boot-usb * [new branch] at91sam9x35-ek - upstream-usb/at91sam9x35-ek + 5b2e031...0b92a45 cdc-at91 - upstream-usb/cdc-at91 (forced update) + 6722fd5...76454b2 master - upstream-usb/master (forced update) * [new branch] merge_pending - upstream-usb/merge_pending + 2c8b43b...01afc4f next - upstream-usb/next (forced update) * [new branch] uboot - upstream-usb/uboot (try-usb=5cf309: include/ lq out/ tools/ x/) ~/u co -b try-usb2 upstream-usb/master Branch try-usb2 set up to track remote branch master from upstream-usb. Switched to a new branch 'try-usb2' (try-usb2=76454b: include/ lq out/ tools/ x/) ~/u git am ~/Downloads/bundle-3480.mbox Applying: tegra: usb: convert USB_PORTS_MAX to be a define Applying: tegra: usb: make controller init functions more self contained Applying: tegra: usb: fold initial pll setup into board_usb_init Applying: tegra: usb: remove unneeded function parameter Applying: tegra: usb: move controller init into start_port Applying: tegra: usb: various small cleanups Applying: tegra: usb: move implementation into right directory error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run git am --resolved. If you would prefer to skip this patch, instead run git am --skip. To restore the original branch and stop patching run git am --abort. Where was the patch that removed drivers/usb/host/ehci-tegra.c? Hm I'm no expert here, but I didn't actually remove the file. I just copied over the contents of the old implementation file and both git commit and git format-patch recognized this as a rename. Also the cherry-pick from my devel to the usb branch worked flawlessly. If git am can't cope with the rename to an already existing file I may post the patch with the rename forcibly removed, but this will yield a much bigger patch. I'll investigate this. Thanks for the heads up. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory
Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren: On 10/30/2012 03:22 AM, Lucas Stach wrote: This moves the Tegra USB implementation into the drivers/usb/host directory. diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c + * Copyright (c) 2009-2012 NVIDIA Corporation * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com Why does NVIDIA's (c) notice change? Just because I took most of the licence header from the ehci_tegra.c file, but as the patch shows the the diff modulo the copied part it looks like a change. I choose this one as it actually spans the longer copyright timeframe of the both licence headers. Is this a problem? Should I also include the web address? Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory
Am Dienstag, den 30.10.2012, 12:51 -0600 schrieb Stephen Warren: On 10/30/2012 12:45 PM, Lucas Stach wrote: Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren: On 10/30/2012 03:22 AM, Lucas Stach wrote: This moves the Tegra USB implementation into the drivers/usb/host directory. diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c + * Copyright (c) 2009-2012 NVIDIA Corporation * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com Why does NVIDIA's (c) notice change? Just because I took most of the licence header from the ehci_tegra.c file, but as the patch shows the the diff modulo the copied part it looks like a change. I choose this one as it actually spans the longer copyright timeframe of the both licence headers. Is this a problem? Should I also include the web address? Hmm. So this patch merges two files together into one? The diff looks like it's creating a new file. If the new content in this patch came from some other file, shouldn't the patch also remove it from the old file? That would make the (c) header change more obvious. Hm, the rename presentation of this patch seems to cause major confusion. Yes, this patch merges the Tegra usb implementation into the pre-existing ehci_tegra.c file, which before this change did not much more than to call into the Tegra SoC usb implementation. As the Tegra usb implementation is not really SoC specific, but rather controller specific this should really move over. I will send this patch in the usual remove-add presentation for a V2 of the series, as it even seems to confuse git right now. Regards, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 09/14] fdt: Add polarity-aware gpio functions to fdtdec
Am Donnerstag, den 25.10.2012, 19:31 -0700 schrieb Simon Glass: From: Sean Paul seanp...@chromium.org Add get and set gpio functions to fdtdec that take into account the polarity field in fdtdec_gpio_state.flags. In another thread Stephen Warren and I came to the conclusion that we most likely should remove this polarity flag from the GPIO bindings. Currently it is only for the USB VBUS GPIO which should move over to regulators once they land in U-Boot. Do you have any other applications for this flag, so we might reconsider removing it? Signed-off-by: Sean Paul seanp...@chromium.org Signed-off-by: Simon Glass s...@chromium.org --- include/fdtdec.h | 16 lib/fdtdec.c | 20 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/include/fdtdec.h b/include/fdtdec.h index 12f73a7..17daa99 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -90,6 +90,22 @@ struct fdt_gpio_state { #define fdt_gpio_isvalid(x) ((x)-gpio != FDT_GPIO_NONE) /** + * Read the GPIO taking into account the polarity of the pin. + * + * @param gpio pointer to the decoded gpio + * @return value of the gpio if successful, 0 if unsuccessful + */ +int fdtdec_get_gpio(struct fdt_gpio_state *gpio); + +/** + * Write the GPIO taking into account the polarity of the pin. + * + * @param gpio pointer to the decoded gpio + * @return 0 if successful + */ +int fdtdec_set_gpio(struct fdt_gpio_state *gpio, int val); + +/** * Find the next numbered alias for a peripheral. This is used to enumerate * all the peripherals of a certain type. * diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 6c417d2..91ba558 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -487,6 +487,26 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name, return err == 1 ? 0 : err; } +int fdtdec_get_gpio(struct fdt_gpio_state *gpio) +{ + int val; + + if (!fdt_gpio_isvalid(gpio)) + return -1; + + val = gpio_get_value(gpio-gpio); + return gpio-flags FDT_GPIO_ACTIVE_LOW ? val ^ 1 : val; +} + +int fdtdec_set_gpio(struct fdt_gpio_state *gpio, int val) +{ + if (!fdt_gpio_isvalid(gpio)) + return -1; + + val = gpio-flags FDT_GPIO_ACTIVE_LOW ? val ^ 1 : val; + return gpio_set_value(gpio-gpio, val); +} + int fdtdec_setup_gpio(struct fdt_gpio_state *gpio) { /* ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: tegra: move Tegra EHCI implementation to correct place
Hi Marek, Am Freitag, den 26.10.2012, 09:09 +0200 schrieb Marek Vasut: Dear Lucas Stach, Move the Tegra EHCI implementation to the correct directory in the tree. This code is specific to the Tegra EHCI controller, not to the Tegra SoC in general. This is not just a move of the code, but also some small changes squashed Unsquash them please, it's really hard to review. Also, use git format-patch -M -C to generate the patchset and to detect renames. I've generated the patch with format-patch -B -M -C, so what you see is basically the diff of the original file with the new implementation. So the diff shows all the small changes I blather about. The changes are squashed in because I did them while moving the implementation over, and I would like to avoid doing them in single patches as it's notably more work and IMHO with the current diff you can clearly see what changed. So please let me know if you are really that keen to have them as separate patches, but it may take me some while to respin this as I'm occupied with other things right now. Thanks, Lucas in. Most notable: - removed some unneeded parameters from function calls, to make functions more self contained - decrease max controller count to 3, both Tegra 2 and 3 have at most 3 EHCI controllers, we can aleays increase this later if the need arises - controllers only get activated at ehci_hcd_init time, not at board_usb_init, which is the more obvious init point and saves time if you are not going to use usb in your boot process at all [...] Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] usb: tegra: move Tegra EHCI implementation to correct place
Move the Tegra EHCI implementation to the correct directory in the tree. This code is specific to the Tegra EHCI controller, not to the Tegra SoC in general. This is not just a move of the code, but also some small changes squashed in. Most notable: - removed some unneeded parameters from function calls, to make functions more self contained - decrease max controller count to 3, both Tegra 2 and 3 have at most 3 EHCI controllers, we can aleays increase this later if the need arises - controllers only get activated at ehci_hcd_init time, not at board_usb_init, which is the more obvious init point and saves time if you are not going to use usb in your boot process at all Signed-off-by: Lucas Stach d...@lynxeye.de --- This patch is based on the u-boot-usb tree I've tested this on the Colibri T20 platform with no functional regressions. All 3 USB controllers (both UTMI and ULPI) work as before the change. --- arch/arm/cpu/armv7/tegra20/Makefile| 2 - .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 210 +++-- 2 Dateien geändert, 109 Zeilen hinzugefügt(+), 103 Zeilen entfernt(-) rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c (87%) diff --git a/arch/arm/cpu/armv7/tegra20/Makefile b/arch/arm/cpu/armv7/tegra20/Makefile index 09a0314..2c4d5c9 100644 --- a/arch/arm/cpu/armv7/tegra20/Makefile +++ b/arch/arm/cpu/armv7/tegra20/Makefile @@ -27,8 +27,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o - COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c similarity index 87% rename from arch/arm/cpu/armv7/tegra20/usb.c rename to drivers/usb/host/ehci-tegra.c index 1bccf2b..0646028 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/drivers/usb/host/ehci-tegra.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2011 The Chromium OS Authors. - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com + * Copyright (c) 2009-2012 NVIDIA Corporation + * Copyright (c) 2012 Lucas Stach * * See file CREDITS for list of people who contributed to this * project. @@ -22,6 +23,12 @@ */ #include common.h +#include fdtdec.h +#include libfdt.h +#include usb.h +#include usb/ulpi.h + +#include asm/errno.h #include asm/io.h #include asm-generic/gpio.h #include asm/arch/clock.h @@ -29,12 +36,11 @@ #include asm/arch/pinmux.h #include asm/arch/tegra.h #include asm/arch/usb.h -#include usb/ulpi.h #include asm/arch-tegra/clk_rst.h #include asm/arch-tegra/sys_proto.h #include asm/arch-tegra/uart.h -#include libfdt.h -#include fdtdec.h + +#include ehci.h #ifdef CONFIG_USB_ULPI #ifndef CONFIG_USB_ULPI_VIEWPORT @@ -43,9 +49,7 @@ #endif #endif -enum { - USB_PORTS_MAX = 4,/* Maximum ports we allow */ -}; +#define USB_PORTS_MAX 3 /* maximum number of ports we allow */ /* Parameters we need for USB */ enum { @@ -146,6 +150,23 @@ static const u8 utmip_elastic_limit = 16; /* UTMIP High Speed Sync Start Delay */ static const u8 utmip_hs_sync_start_delay = 9; +/* + * A known hardware issue where Connect Status Change bit of PORTSC register + * of USB1 controller will be set after Port Reset. + * We have to clear it in order for later device enumeration to proceed. + * This ehci_powerup_fixup overrides the weak function ehci_powerup_fixup + * in ehci-hcd.c. + */ +void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg) +{ + mdelay(50); + if (((u32) status_reg TEGRA_USB_ADDR_MASK) != TEGRA_USB1_BASE) + return; + /* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ + if (ehci_readl(status_reg) EHCI_PS_CSC) + *reg |= EHCI_PS_CSC; +} + /* Put the port into host mode */ static void set_host_mode(struct fdt_usb *config) { @@ -190,19 +211,15 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) /* Enable the UTMIP PHY */ if (config-utmi) setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB); - - /* -* TODO: where do we take the USB1 out of reset? The old code would -* take USB3 out of reset, but not USB1. This code doesn't do either. -*/ } /* set up the UTMI USB controller with the parameters provided */ -static int init_utmi_usb_controller(struct fdt_usb *config, - struct usb_ctlr *usbctlr, const u32 timing[]) +static int init_utmi_usb_controller(struct fdt_usb *config) { u32 val; int loop_count; + u32 *timing; + struct usb_ctlr *usbctlr = config-reg; clock_enable(config-periph_id); @@ -229,6 +246,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config, * PLL Delay CONFIGURATION settings. The following parameters control * the bring up of the plls. */ + timing = usb_pll
Re: [U-Boot] [PATCH v2 2/2] tegra: move to common SPL framework
Am Samstag, den 20.10.2012, 00:08 -0700 schrieb Allen Martin: Change tegra SPL to use common SPL framework. Any tegra specific initialization is now done in spl_board_init() instead of board_init_f()/board_init_r(). Only one SPL boot target is supported on tegra, which is boot to RAM image. jump_to_image_no_args() must be overridden on tegra so the host CPU can be initialized. Signed-off-by: Allen Martin amar...@nvidia.com Tested-by: Lucas Stach d...@lynxeye.de --- v2: Add back some required headers to avoid compiler warnings --- arch/arm/cpu/arm720t/tegra-common/spl.c | 91 +-- arch/arm/include/asm/arch-tegra20/spl.h | 28 ++ include/configs/tegra20-common.h|4 ++ 3 files changed, 46 insertions(+), 77 deletions(-) create mode 100644 arch/arm/include/asm/arch-tegra20/spl.h diff --git a/arch/arm/cpu/arm720t/tegra-common/spl.c b/arch/arm/cpu/arm720t/tegra-common/spl.c index 0d37ce8..c280ab7 100644 --- a/arch/arm/cpu/arm720t/tegra-common/spl.c +++ b/arch/arm/cpu/arm720t/tegra-common/spl.c @@ -23,105 +23,42 @@ * MA 02111-1307 USA */ #include common.h -#include asm/u-boot.h -#include asm/utils.h -#include nand.h -#include mmc.h -#include fat.h -#include version.h -#include i2c.h -#include image.h -#include malloc.h -#include linux/compiler.h #include cpu.h +#include spl.h #include asm/io.h #include asm/arch/clock.h #include asm/arch/pinmux.h #include asm/arch/tegra.h #include asm/arch-tegra/board.h -#include asm/arch-tegra/clk_rst.h -#include asm/arch-tegra/pmc.h -#include asm/arch-tegra/scu.h -#include asm/arch-tegra/sys_proto.h +#include asm/arch/spl.h -DECLARE_GLOBAL_DATA_PTR; -/* Define global data structure pointer to it*/ -static gd_t gdata __attribute__ ((section(.data))); -static bd_t bdata __attribute__ ((section(.data))); - -inline void hang(void) +void spl_board_init(void) { - puts(### ERROR ### Please RESET the board ###\n); - for (;;) - ; -} + struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + + /* enable JTAG */ + writel(0xC0, pmt-pmt_cfg_ctl); -void board_init_f(ulong dummy) -{ board_init_uart_f(); /* Initialize periph GPIOs */ gpio_early_init_uart(); - /* - * We call relocate_code() with relocation target same as the - * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting - * skipped. Instead, only .bss initialization will happen. That's - * all we need - */ - debug(board_init_f()\n); - relocate_code(CONFIG_SPL_STACK, gdata, CONFIG_SPL_TEXT_BASE); + clock_early_init(); + preloader_console_init(); } -/* This requires UART clocks to be enabled */ -static void preloader_console_init(void) +u32 spl_boot_device(void) { - const char *u_boot_rev = U_BOOT_VERSION; - - gd = gdata; - gd-bd = bdata; - gd-flags |= GD_FLG_RELOC; - gd-baudrate = CONFIG_BAUDRATE; - - serial_init(); /* serial communications setup */ - - gd-have_console = 1; - - /* Avoid a second U-Boot coming from this string */ - u_boot_rev = u_boot_rev[7]; - - printf(\nU-Boot SPL %s (%s - %s)\n, u_boot_rev, U_BOOT_DATE, - U_BOOT_TIME); + return BOOT_DEVICE_RAM; } -void board_init_r(gd_t *id, ulong dummy) +void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { - struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; - - /* enable JTAG */ - writel(0xC0, pmt-pmt_cfg_ctl); - - debug(spl:board_init_r()\n); - - mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START, - CONFIG_SYS_SPL_MALLOC_SIZE); - -#ifdef CONFIG_SPL_BOARD_INIT - spl_board_init(); -#endif + debug(image entry point: 0x%X\n, spl_image-entry_point); - clock_early_init(); - serial_init(); - preloader_console_init(); - - start_cpu((u32)CONFIG_SYS_TEXT_BASE); + start_cpu((u32)spl_image-entry_point); halt_avp(); - /* not reached */ -} - -int board_usb_init(const void *blob) -{ - return 0; } diff --git a/arch/arm/include/asm/arch-tegra20/spl.h b/arch/arm/include/asm/arch-tegra20/spl.h new file mode 100644 index 000..5e453c5 --- /dev/null +++ b/arch/arm/include/asm/arch-tegra20/spl.h @@ -0,0 +1,28 @@ +/* + * (C) Copyright 2012 + * NVIDIA Corporation www.nvidia.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
Re: [U-Boot] [PATCH 4/4] ARM: tegra: increase CONFIG_SYS_TEXT_BASE
Am Dienstag, den 16.10.2012, 15:50 -0600 schrieb Stephen Warren: From: Stephen Warren swar...@nvidia.com The SPL has grown. Increase CONFIG_SYS_TEXT_BASE so SPL's BSS does not overlap the main U-Boot. Is there any specific reason why the SPL is now bigger than before? Or is this just because of the general U-Boot rework (like serial multi anywhere)? And by how much has it grown? This is really more out of curiosity rather than any real objection. Aside from this I think the general idea is reasonable, as we are not shipping a particularly slim U-Boot on any Tegra platform, nor do we have to hit a hard size limit, so for the series: Acked-by: Lucas Stach d...@lynxeye.de Signed-off-by: Stephen Warren swar...@nvidia.com --- include/configs/tegra20-common.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index dc7444d..ced278d 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -168,7 +168,7 @@ #define PHYS_SDRAM_1 NV_PA_SDRC_CS0 #define PHYS_SDRAM_1_SIZE0x2000 /* 512M */ -#define CONFIG_SYS_TEXT_BASE 0x0010c000 +#define CONFIG_SYS_TEXT_BASE 0x0010d000 #define CONFIG_SYS_SDRAM_BASEPHYS_SDRAM_1 #define CONFIG_SYS_INIT_RAM_ADDR CONFIG_STACKBASE ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] tegra: nand: make ONFI detection work
Scott, can I have your Acked-by for this, so Tom can take it through the Tegra tree? Thanks, Lucas Am Sonntag, den 07.10.2012, 23:29 +0200 schrieb Lucas Stach: Add the missing bits to the Tegra NAND driver to make ONFI detection work properly. Also add it to the Tegra default config, as it seems to be a reasonable thing to have it available on all boards that use any kind of NAND. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: use puts instead of printf --- drivers/mtd/nand/tegra_nand.c| 36 include/configs/tegra20-common.h | 1 + 2 Dateien geändert, 37 Zeilen hinzugefügt(+) diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index 5408c51..4d94cc6 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -219,6 +219,34 @@ static uint8_t read_byte(struct mtd_info *mtd) } /** + * Read len bytes from the chip into a buffer + * + * @param mtdMTD device structure + * @param bufbuffer to store data to + * @param lennumber of bytes to read + * + * Read function for 8bit bus-width + */ +static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len) +{ + int i, s; + unsigned int reg; + struct nand_chip *chip = mtd-priv; + struct nand_drv *info = (struct nand_drv *)chip-priv; + + for (i = 0; i len; i += 4) { + s = (len - i) 4 ? 4 : len - i; + writel(CMD_PIO | CMD_RX | CMD_A_VALID | CMD_CE0 | + ((s - 1) CMD_TRANS_SIZE_SHIFT) | CMD_GO, + info-reg-command); + if (!nand_waitfor_cmd_completion(info-reg)) + puts(Command timeout during read_buf\n); + reg = readl(info-reg-resp); + memcpy(buf + i, reg, s); + } +} + +/** * Check NAND status to see if it is ready or not * * @param mtdMTD device structure @@ -317,6 +345,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, switch (command) { case NAND_CMD_READID: writel(NAND_CMD_READID, info-reg-cmd_reg1); + writel(column 0xFF, info-reg-addr_reg1); writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_PIO | CMD_RX | ((4 - 1) CMD_TRANS_SIZE_SHIFT) @@ -324,6 +353,12 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, info-reg-command); info-pio_byte_index = 0; break; + case NAND_CMD_PARAM: + writel(NAND_CMD_PARAM, info-reg-cmd_reg1); + writel(column 0xFF, info-reg-addr_reg1); + writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_CE0, + info-reg-command); + break; case NAND_CMD_READ0: writel(NAND_CMD_READ0, info-reg-cmd_reg1); writel(NAND_CMD_READSTART, info-reg-cmd_reg2); @@ -976,6 +1011,7 @@ int tegra_nand_init(struct nand_chip *nand, int devnum) nand-options = LP_OPTIONS; nand-cmdfunc = nand_command; nand-read_byte = read_byte; + nand-read_buf = read_buf; nand-ecc.read_page = nand_read_page_hwecc; nand-ecc.write_page = nand_write_page_hwecc; nand-ecc.read_page_raw = nand_read_page_raw; diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index 744dc59..9e60020 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -204,5 +204,6 @@ #define CONFIG_SPL_LDSCRIPT $(CPUDIR)/tegra20/u-boot-spl.lds #define CONFIG_SYS_NAND_SELF_INIT +#define CONFIG_SYS_NAND_ONFI_DETECTION #endif /* __TEGRA20_COMMON_H */ ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] tegra: add Colibri T20 board support
Am Montag, den 08.10.2012, 10:28 -0600 schrieb Stephen Warren: On 10/07/2012 03:36 PM, Lucas Stach wrote: This adds board support for the Toradex Colibri T20 module. Working functions: - SD card boot - USB boot - Network - NAND environment Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: - rename .dts file to match board name v3: - make comments more meaningful - split into module and carrier board specific part to ease porting to other carrier boards diff --git a/board/toradex/dts/tegra20-colibri_t20_iris.dts b/board/toradex/dts/tegra20-colibri_t20_iris.dts I suppose we can do this later, but since this patch has the C files split into separate board and carrier code, I'd also expect the .dts files to be split up in the same way. I initially tried exactly that, but since the .dts files are compiled a bit different in u-boot than in the linux kernel it's not as easy as doing a simple include. I'm planning to split them up later on, but I first have to familiarize myself with the build process for dts in u-boot. For now I would wish to get this included as is, to get Colibri T20 some public visibility as a working Tegra platform, so others could take this board into account when making changes to the Tegra 20 common platform. Thanks, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] tegra: nand: make ONFI detection work
Add the missing bits to the Tegra NAND driver to make ONFI detection work properly. Also add it to the Tegra default config, as it seems to be a reasonable thing to have it available on all boards that use any kind of NAND. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: use puts instead of printf --- drivers/mtd/nand/tegra_nand.c| 36 include/configs/tegra20-common.h | 1 + 2 Dateien geändert, 37 Zeilen hinzugefügt(+) diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index 5408c51..4d94cc6 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -219,6 +219,34 @@ static uint8_t read_byte(struct mtd_info *mtd) } /** + * Read len bytes from the chip into a buffer + * + * @param mtd MTD device structure + * @param buf buffer to store data to + * @param len number of bytes to read + * + * Read function for 8bit bus-width + */ +static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len) +{ + int i, s; + unsigned int reg; + struct nand_chip *chip = mtd-priv; + struct nand_drv *info = (struct nand_drv *)chip-priv; + + for (i = 0; i len; i += 4) { + s = (len - i) 4 ? 4 : len - i; + writel(CMD_PIO | CMD_RX | CMD_A_VALID | CMD_CE0 | + ((s - 1) CMD_TRANS_SIZE_SHIFT) | CMD_GO, + info-reg-command); + if (!nand_waitfor_cmd_completion(info-reg)) + puts(Command timeout during read_buf\n); + reg = readl(info-reg-resp); + memcpy(buf + i, reg, s); + } +} + +/** * Check NAND status to see if it is ready or not * * @param mtd MTD device structure @@ -317,6 +345,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, switch (command) { case NAND_CMD_READID: writel(NAND_CMD_READID, info-reg-cmd_reg1); + writel(column 0xFF, info-reg-addr_reg1); writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_PIO | CMD_RX | ((4 - 1) CMD_TRANS_SIZE_SHIFT) @@ -324,6 +353,12 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, info-reg-command); info-pio_byte_index = 0; break; + case NAND_CMD_PARAM: + writel(NAND_CMD_PARAM, info-reg-cmd_reg1); + writel(column 0xFF, info-reg-addr_reg1); + writel(CMD_GO | CMD_CLE | CMD_ALE | CMD_CE0, + info-reg-command); + break; case NAND_CMD_READ0: writel(NAND_CMD_READ0, info-reg-cmd_reg1); writel(NAND_CMD_READSTART, info-reg-cmd_reg2); @@ -976,6 +1011,7 @@ int tegra_nand_init(struct nand_chip *nand, int devnum) nand-options = LP_OPTIONS; nand-cmdfunc = nand_command; nand-read_byte = read_byte; + nand-read_buf = read_buf; nand-ecc.read_page = nand_read_page_hwecc; nand-ecc.write_page = nand_write_page_hwecc; nand-ecc.read_page_raw = nand_read_page_raw; diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index 744dc59..9e60020 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -204,5 +204,6 @@ #define CONFIG_SPL_LDSCRIPT$(CPUDIR)/tegra20/u-boot-spl.lds #define CONFIG_SYS_NAND_SELF_INIT +#define CONFIG_SYS_NAND_ONFI_DETECTION #endif /* __TEGRA20_COMMON_H */ -- 1.7.11.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3] tegra: add Colibri T20 board support
This adds board support for the Toradex Colibri T20 module. Working functions: - SD card boot - USB boot - Network - NAND environment Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: - rename .dts file to match board name v3: - make comments more meaningful - split into module and carrier board specific part to ease porting to other carrier boards --- MAINTAINERS| 4 ++ .../colibri_t20-common/colibri_t20-common.c| 44 .../colibri_t20-common/colibri_t20-common.h| 16 + board/toradex/colibri_t20_iris/Makefile| 40 +++ board/toradex/colibri_t20_iris/colibri_t20_iris.c | 46 board/toradex/dts/tegra20-colibri_t20_iris.dts | 38 ++ boards.cfg | 1 + include/configs/colibri_t20_iris.h | 83 ++ 8 Dateien geändert, 272 Zeilen hinzugefügt(+) create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.c create mode 100644 board/toradex/colibri_t20-common/colibri_t20-common.h create mode 100644 board/toradex/colibri_t20_iris/Makefile create mode 100644 board/toradex/colibri_t20_iris/colibri_t20_iris.c create mode 100644 board/toradex/dts/tegra20-colibri_t20_iris.dts create mode 100644 include/configs/colibri_t20_iris.h diff --git a/MAINTAINERS b/MAINTAINERS index 1f03d8d..aa5e1ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -904,6 +904,10 @@ Michal Simek mon...@monstr.eu zynqARM ARMV7 (Zynq SoC) +Lucas Stach d...@lynxeye.de + + colibri_t20_irisTegra20 (ARM7 A9 Dual Core) + Nick Thompson nick.thomp...@gefanuc.com da830evmARM926EJS (DA830/OMAP-L137) diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.c b/board/toradex/colibri_t20-common/colibri_t20-common.c new file mode 100644 index 000..6d5e47d --- /dev/null +++ b/board/toradex/colibri_t20-common/colibri_t20-common.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Lucas Stach + * + * 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. + * + */ + +#include common.h +#include asm/arch/clock.h +#include asm/arch/funcmux.h +#include asm/arch/pinmux.h +#include asm/arch-tegra/board.h + +#include colibri_t20-common.h + +#ifdef CONFIG_USB_EHCI_TEGRA +void colibri_t20_common_pin_mux_usb(void) +{ + /* module internal USB bus to connect ethernet chipset */ + funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); + /* ULPI reference clock output */ + pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); + pinmux_tristate_disable(PINGRP_CDEV2); + /* PHY reset GPIO */ + pinmux_tristate_disable(PINGRP_UAC); + /* VBus GPIO */ + pinmux_tristate_disable(PINGRP_DTE); +} +#endif + +#ifdef CONFIG_TEGRA_NAND +void pin_mux_nand(void) +{ + funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT); +} +#endif diff --git a/board/toradex/colibri_t20-common/colibri_t20-common.h b/board/toradex/colibri_t20-common/colibri_t20-common.h new file mode 100644 index 000..76dc860 --- /dev/null +++ b/board/toradex/colibri_t20-common/colibri_t20-common.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2012 Lucas Stach + * + * 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. + * + */ + +void colibri_t20_common_pin_mux_usb(void); diff --git a/board/toradex/colibri_t20_iris/Makefile b/board/toradex/colibri_t20_iris/Makefile new file mode 100644 index 000..c138729 --- /dev/null +++ b/board/toradex/colibri_t20_iris/Makefile @@ -0,0 +1,40 @@ +# +# (C) Copyright 2012 Lucas Stach +# +# 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
Re: [U-Boot] [RFC] ARM: prevent misaligned array inits
Hi Albert, Am Dienstag, den 02.10.2012, 20:46 +0200 schrieb Albert ARIBAUD: Under option -munaligned-access, gcc can perform local char or 16-bit array initializations using misaligned native accesses which will throw a data abort exception. Fix files where these array initializations were unneeded, and for files known to contain such initializations, enforce gcc option -mno-unaligned-access. Signed-off-by: Albert ARIBAUD albert.u.b...@aribaud.net --- Please test this patch with gcc 4.7 on boards which do data aborts or resets due to misaligned accesses and report result to me. Although, as you know, I don't like the general direction in which this is heading you get a Tested-by: Lucas Stach d...@lynxeye.de As it at least allows for a booting machine in various configurations on my Colibri T20. arch/arm/cpu/arm926ejs/orion5x/cpu.c |4 +- board/ti/omap2420h4/sys_info.c | 24 - common/Makefile |3 ++ common/cmd_dfu.c |2 +- doc/README.arm-unaligned-accesses| 95 ++ fs/fat/Makefile |2 + fs/ubifs/Makefile|3 ++ lib/Makefile |3 ++ 8 files changed, 121 insertions(+), 15 deletions(-) create mode 100644 doc/README.arm-unaligned-accesses diff --git a/arch/arm/cpu/arm926ejs/orion5x/cpu.c b/arch/arm/cpu/arm926ejs/orion5x/cpu.c index c3948d3..5a4775a 100644 --- a/arch/arm/cpu/arm926ejs/orion5x/cpu.c +++ b/arch/arm/cpu/arm926ejs/orion5x/cpu.c @@ -194,8 +194,8 @@ u32 orion5x_device_rev(void) */ int print_cpuinfo(void) { - char dev_str[] = 0x; - char rev_str[] = 0x00; + char dev_str[7]; /* room enough for 0x plus null byte */ + char rev_str[5]; /* room enough for 0x00 plus null byte */ char *dev_name = NULL; char *rev_name = NULL; diff --git a/board/ti/omap2420h4/sys_info.c b/board/ti/omap2420h4/sys_info.c index a9f7241..b462aa5 100644 --- a/board/ti/omap2420h4/sys_info.c +++ b/board/ti/omap2420h4/sys_info.c @@ -237,18 +237,18 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound) */ void display_board_info(u32 btype) { - char cpu_2420[] = 2420; /* cpu type */ - char cpu_2422[] = 2422; - char cpu_2423[] = 2423; - char db_men[] = Menelaus; /* board type */ - char db_ip[] = IP; - char mem_sdr[] = mSDR;/* memory type */ - char mem_ddr[] = mDDR; - char t_tst[] = TST; /* security level */ - char t_emu[] = EMU; - char t_hs[] = HS; - char t_gp[] = GP; - char unk[] = ?; + char *cpu_2420 = 2420; /* cpu type */ + char *cpu_2422 = 2422; + char *cpu_2423 = 2423; + char *db_men = Menelaus; /* board type */ + char *db_ip = IP; + char *mem_sdr = mSDR;/* memory type */ + char *mem_ddr = mDDR; + char *t_tst = TST;/* security level */ + char *t_emu = EMU; + char *t_hs = HS; + char *t_gp = GP; + char *unk = ?; char *cpu_s, *db_s, *mem_s, *sec_s; u32 cpu, rev, sec; diff --git a/common/Makefile b/common/Makefile index 125b2be..19b2130 100644 --- a/common/Makefile +++ b/common/Makefile @@ -227,6 +227,9 @@ $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc $(obj)../tools/envcrc: $(MAKE) -C ../tools +$(obj)hush.o: CFLAGS += -mno-unaligned-access +$(obj)fdt_support.o: CFLAGS += -mno-unaligned-access + # # defines $(obj).depend target diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index 62fb890..01d6b3a 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -30,7 +30,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { const char *str_env; - char s[] = dfu; + char *s = dfu; char *env_bkp; int ret; diff --git a/doc/README.arm-unaligned-accesses b/doc/README.arm-unaligned-accesses new file mode 100644 index 000..00fb1c0 --- /dev/null +++ b/doc/README.arm-unaligned-accesses @@ -0,0 +1,95 @@ +Since U-Boot runs on a variety of hardware, some only able to perform +unaligned accesses with a strong penalty, some unable to perform them +at all, the policy regarding unaligned accesses is to not perform any, +unless absolutely necessary because of hardware or standards. + +Also, on hardware which permits it, the core is configured to throw +data abort exceptions on unaligned accesses in order to catch these +unallowed accesses as early as possible. + +Until version 4.7, the gcc default for performing unaligned accesses +(-mno-unaligned-access) is to emulate unaligned accesses using aligned +loads and stores plus shifts and masks. Emulated unaligned accesses +will not be caught by hardware
Re: [U-Boot] [PATCH 5/7] Tegra30: Cardhu: Add DT files
Am Dienstag, den 02.10.2012, 15:45 -0700 schrieb Tom Warren: These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.). Signed-off-by: Tom Warren twar...@nvidia.com --- arch/arm/dts/tegra30.dtsi | 30 ++ board/nvidia/dts/tegra30-cardhu.dts | 35 +++ 2 files changed, 65 insertions(+), 0 deletions(-) create mode 100644 arch/arm/dts/tegra30.dtsi create mode 100644 board/nvidia/dts/tegra30-cardhu.dts diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi new file mode 100644 index 000..122c134 --- /dev/null +++ b/arch/arm/dts/tegra30.dtsi @@ -0,0 +1,30 @@ +/include/ skeleton.dtsi + +/ { + model = NVIDIA Tegra30; + compatible = nvidia,tegra30; + + clocks { + #address-cells = 1; + #size-cells = 0; + + osc: clock { + compatible = fixed-clock; + #clock-cells = 0; + }; + }; + + gpio: gpio@6000d000 { + compatible = nvidia,tegra30-gpio, nvidia,tegra20-gpio; + reg = 0x6000d000 0x1000; + #gpio-cells = 2; + gpio-controller; + }; + + serial@70006000 { + compatible = nvidia,tegra30-uart, nvidia,tegra20-uart; + reg = 0x70006000 0x40; + reg-shift = 2; + status = disabled; + }; +}; diff --git a/board/nvidia/dts/tegra30-cardhu.dts b/board/nvidia/dts/tegra30-cardhu.dts new file mode 100644 index 000..68563e8 --- /dev/null +++ b/board/nvidia/dts/tegra30-cardhu.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +/memreserve/ 0x1c00 0x0400; +/include/ ARCH_CPU_DTS + +/ { + model = NVIDIA Cardhu; + compatible = nvidia,cardhu, nvidia,tegra30; + + aliases { + }; + +memory { +device_type = memory; +reg = 0x8000 0xc000; +}; + + clocks { + clk_32k: clk_32k { + clock_frequency = 32000; + }; + osc { + clock-frequency = 1200; + }; + }; + + clock@60006000 { + clocks = clk_32k osc; + }; Is this clock thing really needed? I don't think we are doing anything with those DT entries. + + serial@70006000 { + status = ok; + clock-frequency = 21600 ; + }; +}; ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Tegra USB driver movement
Also CC'ing Albert Am Montag, den 01.10.2012, 04:17 +0200 schrieb Marek Vasut: Dear Lucas Stach, Hi all, now that everything involving Colibri T20 is in pretty good shape I'm moving on to some code cleanups to the U-Boot Tegra codebase. One of the big things on my list is the move of the Tegra USB driver implementation to the correct location in drivers/usb/host. In anticipation of this move all USB related changes for the next merge window have already gone through the u-boot-usb tree to minimize conflicts. I think I'll push them into -next once builds are done. Now with the mass renaming of Tegra header files for the Tegra 3 clearing we have another situation which makes the move harder to do without breaking the build of either the u-boot-usb or u-boot-tegra tree. However we can easily solve that with some proper coordination. So the plan is a follows: The mass renaming of the Tegra header files did not generate any back push from developers involved in Tegra. So if Tom is confident that this change is good to go, I would like him to do a pull request to u-boot-arm as soon as possible. On IRC Albert already expressed his plan to do another pull request to u-boot master by Thursday latest. If we could get in the mass rename into this pull request it would be really great, as it would allow to sync the u-boot-usb tree with the current Tegra work in the next week. Once this is done we can easily move the Tegra USB driver without breaking anything. Would this be ok with everyone? Sorry, all the usb changes go to -next. Right all things that we are talking about here are going into the respective next trees. Sorry for the confusion. The plan still holds, except I'm not sure if Albert is also going to do a P-R for u-boot-arm/next, so CC'ing him to let him know that we might also need some help from his side. Thanks, Lucas 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] tegra: add Colibri T20 board support
Am Montag, den 01.10.2012, 10:33 -0600 schrieb Stephen Warren: On 09/29/2012 02:03 PM, Lucas Stach wrote: This adds board support for the Toradex Colibri T20 module. Working functions: - SD card boot - USB boot - Network - NAND environment diff --git a/board/toradex/colibri_t20/Makefile b/board/toradex/colibri_t20/Makefile ... +# \ No newline at end of file I assume that's a mistake. Another one... diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c +#ifdef CONFIG_USB_EHCI_TEGRA +void pin_mux_usb(void) +{ + /* USB 1 aka Tegra USB port 3 */ + pinmux_tristate_disable(PINGRP_SPIG); I don't think that's muxing USB itself, but rather muxing perhaps the VBUS GPIO? That's right. I'll do a comment to make this more obvious. +#ifdef CONFIG_TEGRA_MMC +int board_mmc_init(bd_t *bd) +{ + funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); + pinmux_tristate_disable(PINGRP_GMB); It might be useful to comment the tristate call like other boards, e.g.: /* For power GPIO PI6 */ pinmux_tristate_disable(PINGRP_ATA); so it's obvious why the call isn't done inside funcmux_select(). diff --git a/board/toradex/dts/tegra20-colibri_t20.dts b/board/toradex/dts/tegra20-colibri_t20.dts + usb@c5008000 { + nvidia,vbus-gpio = gpio 178 1; /* PW2 low-active */ + }; As an FYI, although the GPIO bindings do specify that the last cell there is for GPIO flags, I'm not sure that we should rely on it. Not all GPIO bindings actually have the ability to specify flags there, so if a given board's GPIO is provided by some device whose GPIO binding doesn't allow for flags, then it won't be possible to specify an active-low GPIO, and this won't work. The kernel certainly doesn't actually do anything with the flags argument in the EHCI driver, IIRC. Either we should forcibly change all GPIO bindings in the kernel to require that they allow flags to be specified (probably very hard), or remove the flags from the Tegra GPIO binding, and use a separate property such as nvidia,vbus-gpio-active-low for this purpose. Certainly, the latter form of approach has been taken in other places (such as fixed regulator IIRC). You mentioned that your plan is to bring over the regulator thing from the kernel to u-boot. So IMHO the correct approach would be to just use a fixed regulator for VBUS, where we already have the active-low property in the binding. So can we just let this sit as it is now, and agree to remove the GPIO active-low flag from the Tegra GPIO binding and every use of it as soon as we have proper regulators in u-boot? Thanks for the review, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2 1/2] tegra: clean up board include hell
Hi Tom, Am Montag, den 01.10.2012, 10:12 -0700 schrieb Tom Warren: Lucas, Stephen, et al. On Mon, Oct 1, 2012 at 9:39 AM, Tom Warren twarren.nvi...@gmail.com wrote: Lucas, On Mon, Oct 1, 2012 at 9:24 AM, Stephen Warren swar...@wwwdotorg.org wrote: On 09/29/2012 02:02 PM, Lucas Stach wrote: The prototypes used in board files were all scattered out, which lead to code duplication between SPL and normal U-Boot and some prototypes not actually being used. Consolidate this in a common board header. Seems reasonable enough to me. This series or anything similar that's also OK with Tom is: Acked-by: Stephen Warren swar...@nvidia.com I don't think this hurts anything. I'll see if it applies cleanly to u-boot-tegra/next and let you know. Tom I've applied Lucas' include file cleanup patches, and done a .MAKEALL -s tegra20 and a checkpatch run w/o error, so I've pushed a new u-boot-tegra/next to denx.de. Here are the latest commits in that repo since Albert's last ARM update: 0edfb9c tegra: nand: add board pinmux a05feff tegra: clean up board include hell 9c53038 tegra: add funcmux entry for NAND attached to KBC 08eb412 tegra20: rework UART GPIO handling 55da8d1 tegra20: add clock_set_pllout function 20e825f tegra20: complete periph_id enum b1ae54d tegra: enable CONFIG_CMD_PART 0e1b95c Tegra20: Move some include files to arch-tegra for sharing with Tegra30 bfba961 Tegra20: Move some code files to common directories for upcoming Tegra30 4910a5c tegra: Rename Medcom to Medcom-Wide 81637cd tegra: Update Avionic Design vendor prefix This is what I'm going to base my imminent T30 patches on. Hope to have something for review in a day or two. Can you do a P-R to Albert to include this in the u-boot-arm/next tree? The reason I'm prodding is that we need the following two patches to propagate to the u-boot-usb/next tree, to make the the USB driver move feasible. 0e1b95c Tegra20: Move some include files to arch-tegra for sharing with Tegra30 bfba961 Tegra20: Move some code files to common directories for upcoming Tegra30 As the u-boot/next tree is already open for merging I think the best way to achieve this is to let it trickle upstream, so that Marek can just base his next tree on an updated version of u-boot/next. There is no reason to to wait for the Tegra 3 work to land, except if you plan to rework the two mentioned commits along the way. Thanks, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4 1/2] usb: ulpi: add indicator configuration function
Allows for easy configuration of the VBUS indicator related ULPI config bits. Also move the external indicator setup from ulpi_set_vbus() to the new function. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Igor Grinberg grinb...@compulab.co.il --- v4: - do r-m-w access on iface_ctrl register - align with coding style of other ulpi functions --- drivers/usb/ulpi/ulpi.c | 32 include/usb/ulpi.h | 13 +++-- 2 Dateien geändert, 39 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c index dde2585..23b59e7 100644 --- a/drivers/usb/ulpi/ulpi.c +++ b/drivers/usb/ulpi/ulpi.c @@ -106,20 +106,44 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed) return ulpi_write(ulpi_vp, ulpi-function_ctrl, val); } -int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power, - int ext_ind) +int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power) { u32 flags = ULPI_OTG_DRVVBUS; u8 *reg = on ? ulpi-otg_ctrl_set : ulpi-otg_ctrl_clear; if (ext_power) flags |= ULPI_OTG_DRVVBUS_EXT; - if (ext_ind) - flags |= ULPI_OTG_EXTVBUSIND; return ulpi_write(ulpi_vp, reg, flags); } +int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external, + int passthu, int complement) +{ + u32 flags, val; + u8 *reg; + + reg = external ? ulpi-otg_ctrl_set : ulpi-otg_ctrl_clear; + val = ulpi_write(ulpi_vp, reg, ULPI_OTG_EXTVBUSIND); + if (val) + return val; + + flags = passthu ? ULPI_IFACE_PASSTHRU : 0; + flags |= complement ? ULPI_IFACE_EXTVBUS_COMPLEMENT : 0; + + val = ulpi_read(ulpi_vp, ulpi-iface_ctrl); + if (val == ULPI_ERROR) + return val; + + val = val ~(ULPI_IFACE_PASSTHRU ULPI_IFACE_EXTVBUS_COMPLEMENT); + val |= flags; + val = ulpi_write(ulpi_vp, ulpi-iface_ctrl, val); + if (val) + return val; + + return 0; +} + int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable) { u32 val = ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN; diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h index 9a75c24..99166c4 100644 --- a/include/usb/ulpi.h +++ b/include/usb/ulpi.h @@ -61,8 +61,17 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed); * * returns 0 on success, ULPI_ERROR on failure. */ -int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, - int on, int ext_power, int ext_ind); +int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power); + +/* + * Configure VBUS indicator + * @external - external VBUS over-current indicator is used + * @passthru - disables ANDing of internal VBUS comparator + *with external VBUS input + * @complement - inverts the external VBUS input + */ +int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external, + int passthru, int complement); /* * Enable/disable pull-down resistors on D+ and D- USB lines. -- 1.7.11.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4 2/2] tegra20: add USB ULPI init code
This adds the required code to set up a ULPI USB port. It is mostly a port of the Linux ULPI setup code with some tweaks added for more correctness, discovered along the way of debugging this. To use this both CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT have to be set in the board configuration file. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Igor Grinberg grinb...@compulab.co.il --- v2: - move all controller init stuff in the respective functions to make them self contained - let board define ULPI_REF_CLK to account for the possibility that some ULPI phys need a other ref clk than 24MHz - don't touch ULPI regs directly, use ULPI framework functions - don't hide error messages under debug() v3: - apply last comments from Igor, which make code still a bit cleaner - add description of CONFIG_ULPI_REF_CLK to README v4: - fix typos spotted by Igor --- README | 3 + arch/arm/cpu/armv7/tegra20/usb.c| 153 +++- arch/arm/include/asm/arch-tegra20/usb.h | 29 -- 3 Dateien geändert, 158 Zeilen hinzugefügt(+), 27 Zeilen entfernt(-) diff --git a/README b/README index a745d0b..70fbf95 100644 --- a/README +++ b/README @@ -1264,6 +1264,9 @@ The following options need to be configured: viewport is supported. To enable the ULPI layer support, define CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT in your board configuration file. + If your ULPI phy needs a different reference clock than the + standard 24 MHz then you have to define CONFIG_ULPI_REF_CLK to + the appropriate value in Hz. - MMC Support: The MMC controller on the Intel PXA is supported. To diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c index eda8e6f..1b52b16 100644 --- a/arch/arm/cpu/armv7/tegra20/usb.c +++ b/arch/arm/cpu/armv7/tegra20/usb.c @@ -32,9 +32,17 @@ #include asm/arch/sys_proto.h #include asm/arch/uart.h #include asm/arch/usb.h +#include usb/ulpi.h #include libfdt.h #include fdtdec.h +#ifdef CONFIG_USB_ULPI + #ifndef CONFIG_USB_ULPI_VIEWPORT + #error To use CONFIG_USB_ULPI on Tegra Boards you have to also \ + define CONFIG_USB_ULPI_VIEWPORT + #endif +#endif + enum { USB_PORTS_MAX = 4,/* Maximum ports we allow */ }; @@ -68,11 +76,13 @@ enum dr_mode { struct fdt_usb { struct usb_ctlr *reg; /* address of registers in physical memory */ unsigned utmi:1;/* 1 if port has external tranceiver, else 0 */ + unsigned ulpi:1;/* 1 if port has external ULPI transceiver */ unsigned enabled:1; /* 1 to enable, 0 to disable */ unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */ enum dr_mode dr_mode; /* dual role mode */ enum periph_id periph_id;/* peripheral id */ struct fdt_gpio_state vbus_gpio;/* GPIO for vbus enable */ + struct fdt_gpio_state phy_reset_gpio; /* GPIO to reset ULPI phy */ }; static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */ @@ -187,8 +197,8 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) */ } -/* set up the USB controller with the parameters provided */ -static int init_usb_controller(struct fdt_usb *config, +/* set up the UTMI USB controller with the parameters provided */ +static int init_utmi_usb_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr, const u32 timing[]) { u32 val; @@ -297,17 +307,115 @@ static int init_usb_controller(struct fdt_usb *config, if (!loop_count) return -1; - return 0; -} + /* Disable ICUSB FS/LS transceiver */ + clrbits_le32(usbctlr-icusb_ctrl, IC_ENB1); + + /* Select UTMI parallel interface */ + clrsetbits_le32(usbctlr-port_sc1, PTS_MASK, + PTS_UTMI PTS_SHIFT); + clrbits_le32(usbctlr-port_sc1, STS); -static void power_up_port(struct usb_ctlr *usbctlr) -{ /* Deassert power down state */ clrbits_le32(usbctlr-utmip_xcvr_cfg0, UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | UTMIP_FORCE_PDZI_POWERDOWN); clrbits_le32(usbctlr-utmip_xcvr_cfg1, UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | UTMIP_FORCE_PDDR_POWERDOWN); + + return 0; +} + +#ifdef CONFIG_USB_ULPI +/* if board file does not set a ULPI reference frequency we default to 24MHz */ +#ifndef CONFIG_ULPI_REF_CLK +#define CONFIG_ULPI_REF_CLK 2400 +#endif + +/* set up the ULPI USB controller with the parameters provided */ +static int init_ulpi_usb_controller(struct fdt_usb *config, + struct usb_ctlr *usbctlr) +{ + u32 val; + int loop_count; + struct ulpi_viewport ulpi_vp; + + /* set up ULPI reference
[U-Boot] Tegra USB driver movement
Hi all, now that everything involving Colibri T20 is in pretty good shape I'm moving on to some code cleanups to the U-Boot Tegra codebase. One of the big things on my list is the move of the Tegra USB driver implementation to the correct location in drivers/usb/host. In anticipation of this move all USB related changes for the next merge window have already gone through the u-boot-usb tree to minimize conflicts. Now with the mass renaming of Tegra header files for the Tegra 3 clearing we have another situation which makes the move harder to do without breaking the build of either the u-boot-usb or u-boot-tegra tree. However we can easily solve that with some proper coordination. So the plan is a follows: The mass renaming of the Tegra header files did not generate any back push from developers involved in Tegra. So if Tom is confident that this change is good to go, I would like him to do a pull request to u-boot-arm as soon as possible. On IRC Albert already expressed his plan to do another pull request to u-boot master by Thursday latest. If we could get in the mass rename into this pull request it would be really great, as it would allow to sync the u-boot-usb tree with the current Tegra work in the next week. Once this is done we can easily move the Tegra USB driver without breaking anything. Would this be ok with everyone? Thanks, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] tegra: nand: make ONFI detection work
Am Freitag, den 28.09.2012, 17:35 -0500 schrieb Scott Wood: On 09/28/2012 10:56:51 AM, Lucas Stach wrote: Add the missing bits to the Tegra NAND driver to make ONFI detection work properly. Also add it to the Tegra default config, as it seems to be a reasonable thing to have it available on all boards that use any kind of NAND. Signed-off-by: Lucas Stach d...@lynxeye.de --- drivers/mtd/nand/tegra_nand.c| 36 include/configs/tegra20-common.h | 1 + 2 Dateien geändert, 37 Zeilen hinzugefügt(+) diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index 2c1b533..0d7ca5d 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -219,6 +219,34 @@ static uint8_t read_byte(struct mtd_info *mtd) } /** + * Read len bytes from the chip into a buffer + * + * @param mtd MTD device structure + * @param buf buffer to store data to + * @param len number of bytes to read + * + * Read function for 8bit bus-width + */ +static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len) +{ + int i, s; + unsigned int reg; + struct nand_chip *chip = mtd-priv; + struct nand_drv *info = (struct nand_drv *)chip-priv; + + for (i = 0; i len; i += 4) { + s = (len - i) 4 ? 4 : len - i; + writel(CMD_PIO | CMD_RX | CMD_A_VALID | CMD_CE0 | + ((s - 1) CMD_TRANS_SIZE_SHIFT) | CMD_GO, + info-reg-command); + if (!nand_waitfor_cmd_completion(info-reg)) + printf(Command timeout during read_buf\n); + reg = readl(info-reg-resp); + memcpy(buf + i, reg, s); + } +} Out of curiousity, what is it about this that needed a custom read_buf() where you didn't need one before? The ONFI parameter page is read before everything is initialized correctly. Because of this we can not use the common way of reading a page with the DMA functionality of the Tegra NAND controller. So for ONFI detection to work we have to implement a readbuf function which uses PIO to read the page. Note that I'm still no NAND expert, this is just what I could figure out from reading the ONFI spec and the programming information for the NAND controller in the Tegra TRM. Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] tegra: clean up board include hell
The prototypes used in board files were all scattered out, which lead to code duplication between SPL and normal U-Boot and some prototypes not actually being used. Consolidate this in a common board header. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: remove wrong paragraph about how to move ahead in the commit message --- arch/arm/cpu/arm720t/tegra-common/board.h | 25 - arch/arm/cpu/arm720t/tegra-common/spl.c | 2 +- arch/arm/cpu/tegra-common/board.c | 1 + arch/arm/include/asm/arch-tegra/board.h | 19 +++- board/nvidia/common/board.c | 1 - board/nvidia/common/board.h | 37 --- board/nvidia/common/uart-spi-switch.c | 2 +- 7 Dateien geändert, 21 Zeilen hinzugefügt(+), 66 Zeilen entfernt(-) delete mode 100644 arch/arm/cpu/arm720t/tegra-common/board.h delete mode 100644 board/nvidia/common/board.h diff --git a/arch/arm/cpu/arm720t/tegra-common/board.h b/arch/arm/cpu/arm720t/tegra-common/board.h deleted file mode 100644 index 260767d..000 --- a/arch/arm/cpu/arm720t/tegra-common/board.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * (C) Copyright 2010-2011 - * NVIDIA Corporation www.nvidia.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 - */ - -void board_init_uart_f(void); -void gpio_early_init_uart(void); diff --git a/arch/arm/cpu/arm720t/tegra-common/spl.c b/arch/arm/cpu/arm720t/tegra-common/spl.c index dfe36b9..0d37ce8 100644 --- a/arch/arm/cpu/arm720t/tegra-common/spl.c +++ b/arch/arm/cpu/arm720t/tegra-common/spl.c @@ -33,13 +33,13 @@ #include image.h #include malloc.h #include linux/compiler.h -#include board.h #include cpu.h #include asm/io.h #include asm/arch/clock.h #include asm/arch/pinmux.h #include asm/arch/tegra.h +#include asm/arch-tegra/board.h #include asm/arch-tegra/clk_rst.h #include asm/arch-tegra/pmc.h #include asm/arch-tegra/scu.h diff --git a/arch/arm/cpu/tegra-common/board.c b/arch/arm/cpu/tegra-common/board.c index ff90a52..b2e10c6 100644 --- a/arch/arm/cpu/tegra-common/board.c +++ b/arch/arm/cpu/tegra-common/board.c @@ -26,6 +26,7 @@ #include asm/arch/clock.h #include asm/arch/funcmux.h #include asm/arch/tegra.h +#include asm/arch-tegra/board.h #include asm/arch-tegra/pmc.h #include asm/arch-tegra/sys_proto.h #include asm/arch-tegra/warmboot.h diff --git a/arch/arm/include/asm/arch-tegra/board.h b/arch/arm/include/asm/arch-tegra/board.h index a90d36c..7e56df7 100644 --- a/arch/arm/include/asm/arch-tegra/board.h +++ b/arch/arm/include/asm/arch-tegra/board.h @@ -24,7 +24,24 @@ #ifndef _TEGRA_BOARD_H_ #define _TEGRA_BOARD_H_ -/* Setup UARTs for the board according to the selected config */ +/* Set up pinmux to make UART usable */ +void gpio_config_uart(void); /* CONFIG_SPI_UART_SWITCH */ +void gpio_early_init_uart(void); /*!CONFIG_SPI_UART_SWITCH */ + +/* Set up early UART output */ void board_init_uart_f(void); +/* Set up any early GPIOs the board might need for proper operation */ +void gpio_early_init(void); /* overrideable GPIO config*/ + +/* + * Hooks to allow boards to set up the pinmux for a specific function. + * Has to be implemented in the board files as we don't yet support pinmux + * setup from FTD. If a board file does not implement one of those functions + * an empty stub function will be called. + */ + +void pin_mux_usb(void); /* overrideable USB pinmux setup */ +void pin_mux_spi(void); /* overrideable SPI pinmux setup */ + #endif diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index bd194bc..dc301e7 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -39,7 +39,6 @@ #include asm/arch-tegra/warmboot.h #include spi.h #include i2c.h -#include board.h #include emc.h DECLARE_GLOBAL_DATA_PTR; diff --git a/board/nvidia/common/board.h b/board/nvidia/common/board.h deleted file mode 100644 index dada4c4..000 --- a/board/nvidia/common/board.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright 2010,2011 - * NVIDIA Corporation www.nvidia.com - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute
[U-Boot] [PATCH v2 2/2] tegra: nand: add board pinmux
Boards may require a different pinmux setup for NAND than the default one. Add a way to call into board specific code to set this up. Signed-off-by: Lucas Stach d...@lynxeye.de --- v2: move pinmux setup to common Tegra board code --- arch/arm/include/asm/arch-tegra/board.h | 1 + board/nvidia/common/board.c | 12 drivers/mtd/nand/tegra_nand.c | 1 - 3 Dateien geändert, 13 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/arch/arm/include/asm/arch-tegra/board.h b/arch/arm/include/asm/arch-tegra/board.h index 7e56df7..be6bf25 100644 --- a/arch/arm/include/asm/arch-tegra/board.h +++ b/arch/arm/include/asm/arch-tegra/board.h @@ -43,5 +43,6 @@ void gpio_early_init(void); /* overrideable GPIO config */ void pin_mux_usb(void); /* overrideable USB pinmux setup */ void pin_mux_spi(void); /* overrideable SPI pinmux setup */ +void pin_mux_nand(void); /* overrideable NAND pinmux setup */ #endif diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index dc301e7..2c7cd0d 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -27,6 +27,7 @@ #include asm/io.h #include asm/arch/clock.h #include asm/arch/emc.h +#include asm/arch/funcmux.h #include asm/arch/pinmux.h #include asm/arch/pmu.h #include asm/arch/tegra.h @@ -77,6 +78,13 @@ void __gpio_early_init_uart(void) void gpio_early_init_uart(void) __attribute__((weak, alias(__gpio_early_init_uart))); +void __pin_mux_nand(void) +{ + funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT); +} + +void pin_mux_nand(void) __attribute__((weak, alias(__pin_mux_nand))); + /* * Routine: power_det_init * Description: turn off power detects @@ -137,6 +145,10 @@ int board_init(void) board_usb_init(gd-fdt_blob); #endif +#ifdef CONFIG_TEGRA_NAND + pin_mux_nand(); +#endif + #ifdef CONFIG_TEGRA_LP0 /* save Sdram params to PMC 2, 4, and 24 for WB0 */ warmboot_save_sdram_params(); diff --git a/drivers/mtd/nand/tegra_nand.c b/drivers/mtd/nand/tegra_nand.c index 2c1b533..5408c51 100644 --- a/drivers/mtd/nand/tegra_nand.c +++ b/drivers/mtd/nand/tegra_nand.c @@ -992,7 +992,6 @@ int tegra_nand_init(struct nand_chip *nand, int devnum) /* Adjust timing for NAND device */ setup_timing(config-timing, info-reg); - funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT); fdtdec_setup_gpio(config-wp_gpio); gpio_direction_output(config-wp_gpio.gpio, 1); -- 1.7.11.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] tegra: add Colibri T20 board support
This adds board support for the Toradex Colibri T20 module. Working functions: - SD card boot - USB boot - Network - NAND environment Signed-off-by: Lucas Stach d...@lynxeye.de CC: Stephen Warren swar...@wwwdotorg.org CC: Tom Warren twarren.nvi...@gmail.com --- v2: rename .dts file to match board name --- MAINTAINERS | 4 ++ board/toradex/colibri_t20/Makefile| 38 ++ board/toradex/colibri_t20/colibri_t20.c | 64 +++ board/toradex/dts/tegra20-colibri_t20.dts | 39 ++ boards.cfg| 1 + include/configs/colibri_t20.h | 84 +++ 6 Dateien geändert, 230 Zeilen hinzugefügt(+) create mode 100644 board/toradex/colibri_t20/Makefile create mode 100644 board/toradex/colibri_t20/colibri_t20.c create mode 100644 board/toradex/dts/tegra20-colibri_t20.dts create mode 100644 include/configs/colibri_t20.h diff --git a/MAINTAINERS b/MAINTAINERS index a00e850..6b3e9a4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -890,6 +890,10 @@ Matt Sealey m...@genesi-usa.com Bo Shen voice.s...@atmel.com at91sam9x5ekARM926EJS (AT91SAM9G15,G25,G35,X25,X35 SoC) +Lucas Stach d...@lynxeye.de + + colibri_t20 Tegra20 (ARM7 A9 Dual Core) + Nick Thompson nick.thomp...@gefanuc.com da830evmARM926EJS (DA830/OMAP-L137) diff --git a/board/toradex/colibri_t20/Makefile b/board/toradex/colibri_t20/Makefile new file mode 100644 index 000..b8c61b6 --- /dev/null +++ b/board/toradex/colibri_t20/Makefile @@ -0,0 +1,38 @@ +# +# (C) Copyright 2012 Lucas Stach +# +# 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. +# +# + +include $(TOPDIR)/config.mk + +$(shell mkdir -p $(obj)../../nvidia/common) + +LIB= $(obj)lib$(BOARD).o + +COBJS := ../../nvidia/common/board.o +COBJS += $(BOARD).o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB):$(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# \ No newline at end of file diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c new file mode 100644 index 000..0ad4311 --- /dev/null +++ b/board/toradex/colibri_t20/colibri_t20.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010,2011 NVIDIA Corporation www.nvidia.com + * Copyright (C) 2012 Lucas Stach + * + * 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. + * + */ + +#include common.h +#include asm/gpio.h +#include asm/arch/clock.h +#include asm/arch/funcmux.h +#include asm/arch/pinmux.h +#include asm/arch-tegra/board.h +#include asm/arch-tegra/sys_proto.h +#include asm/arch-tegra/tegra.h + +#ifdef CONFIG_TEGRA_MMC +#include asm/arch-tegra/mmc.h +#endif + +#ifdef CONFIG_USB_EHCI_TEGRA +void pin_mux_usb(void) +{ + /* USB 1 aka Tegra USB port 3 */ + pinmux_tristate_disable(PINGRP_SPIG); + + /* USB 3 aka Tegra USB port 2 */ + funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); + pinmux_tristate_disable(PINGRP_UAC); + /* ULPI reference clock output */ + pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); + pinmux_tristate_disable(PINGRP_CDEV2); + /* VBus GPIO */ + pinmux_tristate_disable(PINGRP_DTE); +} +#endif + +#ifdef CONFIG_TEGRA_MMC +int board_mmc_init(bd_t *bd) +{ + funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); + pinmux_tristate_disable(PINGRP_GMB); + + tegra_mmc_init(0, 4, -1, GPIO_PC7); + + return 0; +} +#endif + +#ifdef CONFIG_TEGRA_NAND +void pin_mux_nand(void) +{ + funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT); +} +#endif diff --git a/board/toradex/dts/tegra20-colibri_t20.dts b/board/toradex/dts/tegra20-colibri_t20.dts new file mode 100644 index 000..29db0c8 --- /dev/null +++ b/board
Re: [U-Boot] [PATCH v3 1/2] usb: ulpi: add indicator configuration function
Am Freitag, den 28.09.2012, 10:15 +0200 schrieb Igor Grinberg: On 09/26/12 00:35, Lucas Stach wrote: Allows for easy configuration of the VBUS indicator related ULPI config bits. Also move the external indicator setup from ulpi_set_vbus() to the new function. Signed-off-by: Lucas Stach d...@lynxeye.de Acked-by: Igor Grinberg grinb...@compulab.co.il --- v3: Only touch each register once. Now checkpatch clean. --- drivers/usb/ulpi/ulpi.c | 32 include/usb/ulpi.h | 13 +++-- 2 Dateien geändert, 39 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c index dde2585..98dd23c 100644 --- a/drivers/usb/ulpi/ulpi.c +++ b/drivers/usb/ulpi/ulpi.c @@ -106,20 +106,44 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed) return ulpi_write(ulpi_vp, ulpi-function_ctrl, val); } -int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power, - int ext_ind) +int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power) { u32 flags = ULPI_OTG_DRVVBUS; u8 *reg = on ? ulpi-otg_ctrl_set : ulpi-otg_ctrl_clear; if (ext_power) flags |= ULPI_OTG_DRVVBUS_EXT; - if (ext_ind) - flags |= ULPI_OTG_EXTVBUSIND; return ulpi_write(ulpi_vp, reg, flags); } +int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external, + int passthu, int complement) +{ + u32 flags; + int ret; + + ret = ulpi_write(ulpi_vp, + external ? ulpi-otg_ctrl_set : ulpi-otg_ctrl_clear, + ULPI_OTG_EXTVBUSIND); I think the below would be clearer and also will look as the rest of the file does: reg = external ? ulpi-otg_ctrl_set : ulpi-otg_ctrl_clear; ret = ulpi_write(ulpi_vp, reg, ULPI_OTG_EXTVBUSIND); + if (ret) + return ret; + + flags = passthu ? ULPI_IFACE_PASSTHRU : 0; + flags |= complement ? ULPI_IFACE_EXTVBUS_COMPLEMENT : 0; + ret = ulpi_write(ulpi_vp, ulpi-iface_ctrl_set, flags); + if (ret) + return ret; + + flags = passthu ? 0 : ULPI_IFACE_PASSTHRU; + flags |= complement ? 0 : ULPI_IFACE_EXTVBUS_COMPLEMENT; + ret = ulpi_write(ulpi_vp, ulpi-iface_ctrl_clear, flags); Errr..., that is not what I meant... sorry for confusion. What I meant is something like: u32 pthrough = passthu ? ULPI_IFACE_PASSTHRU : 0; u32 extcompl |= complement ? ULPI_IFACE_EXTVBUS_COMPLEMENT : 0; val = ulpi_read(ulpi_vp, ulpi-iface_ctrl); if (val == ULPI_ERROR) return val; val = (val ~ULPI_IFACE_PASSTHRU) | pthrough; val = (val ~ULPI_IFACE_EXTVBUS_COMPLEMENT) | extcompl; ret = ulpi_write(ulpi_vp, ulpi-iface_ctrl, val); That way you write only once to each register and the code also look uniform. I tend to disagree. The ULPI PHY register set was specifically designed to not need this use-modify-write dance. Why would we like to ignore this? Yes we are possible doing one unneeded register access here, but what would it buy us to ignore the set/clear registers just to avoid one register access? + if (ret) + return ret; + + return 0; +} + int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable) { u32 val = ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN; diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h index 9a75c24..99166c4 100644 --- a/include/usb/ulpi.h +++ b/include/usb/ulpi.h @@ -61,8 +61,17 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed); * * returns 0 on success, ULPI_ERROR on failure. */ -int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, - int on, int ext_power, int ext_ind); +int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power); + +/* + * Configure VBUS indicator + * @external - external VBUS over-current indicator is used + * @passthru - disables ANDing of internal VBUS comparator + *with external VBUS input + * @complement - inverts the external VBUS input + */ +int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external, + int passthru, int complement); /* * Enable/disable pull-down resistors on D+ and D- USB lines. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 15/16] lcd: Add CONSOLE_SCROLL_LINES option to speed console
Am Donnerstag, den 27.09.2012, 17:44 -0700 schrieb Simon Glass: When the cursor position gets to the end of the LCD console we normally scroll by one line. This adds an option to increase that value. Console scrolling is often slow, and if a large amount of output is being sent, increasing this option to 10 or so will speed things up considerably. Signed-off-by: Simon Glass s...@chromium.org --- Changes in v3: - Fix tiny bug in mult-line lcd scrolling Changes in v4: - Use CONFIG_CONSOLE_SCROLL_LINES instead of CONSOLE_SCROLL_LINES - Put default CONFIG_CONSOLE_SCROLL_LINES at top of file README |6 ++ common/lcd.c | 18 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README b/README index 1d0ce50..14b1f83 100644 --- a/README +++ b/README @@ -1449,6 +1449,12 @@ The following options need to be configured: here, since it is cheaper to change data cache settings on a per-section basis. + CONFIG_CONSOLE_SCROLL_LINES + + When the console need to be scrolled, this is the number of + lines to scroll by. It defaults to 1. Increasing this makes + the console jump but can help speed up operation when scrolling + is slow. - Splash Screen Support: CONFIG_SPLASH_SCREEN diff --git a/common/lcd.c b/common/lcd.c index 74fa3f9..460f0ca 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -76,6 +76,11 @@ #define CONFIG_LCD_ALIGNMENT PAGE_SIZE #endif +/* By default we scroll by a single line */ +#ifndef CONFIG_CONSOLE_SCROLL_LINES +#define CONFIG_CONSOLE_SCROLL_LINES 1 +#endif + DECLARE_GLOBAL_DATA_PTR; ulong lcd_setmem (ulong addr); @@ -131,12 +136,20 @@ void lcd_set_flush_dcache(int flush) static void console_scrollup(void) { + const int rows = CONFIG_CONSOLE_SCROLL_LINES; + /* Copy up rows ignoring the first one */ Comment is inaccurate as you possibly ignore more than the first line. - memcpy(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE); + memcpy(CONSOLE_ROW_FIRST, +lcd_console_address + CONSOLE_ROW_SIZE * rows, +CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows); /* Clear the last one */ Same as above. - memset(CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE); + memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows, + COLOR_MASK(lcd_color_bg), +CONSOLE_ROW_SIZE * rows); + lcd_sync(); + console_row -= rows; } /*--*/ @@ -165,7 +178,6 @@ static inline void console_newline(void) if (console_row = CONSOLE_ROWS) { /* Scroll everything up */ console_scrollup(); - --console_row; } else { lcd_sync(); } ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot