hwconfig and some its users (was: Re: [PATCH 2/6] Add FSL "Can use" framework)
Subsystems (3)
cover hwconfig and some its users (was: Re: [PATCH 2/6] Add FSL "Can use" framework)
Quoted 6 lines · Wolfgang Denk
Dear Anton Vorontsov,
Quoted 3 lines · In message <[email protected]> you wrote:
So far it's used for specifying whether we want to use FSL DR USB or FSL eSDHC devices on MPC837X processors.
Quoted 6 lines
Quoted 3 lines
There are two more candidates for future use:
1. USB ULPI PHY vs. TSEC1 on MPC8315E-RDB boards;
2. Marvell vs. Vitesse PHYs on MPC8313E-RDB boards.If you know that might need to be extended, than better plan for it right from the beginning.
OK. Done.
Quoted 37 lines
board/freescale/common/fsl_can_use.c
Quoted 5 lines
board/freescale/common/fsl_can_use.c new file +0
-0That's a very strange name for a function, IMHO. I would expect that it has something to do with using a CAN controller...
Quoted 1 line
+int
__fsl_can_use_dr_usb(void)If you plan to make this extendable, please use a more generic name. For example:
fsl_hwconfig()[note that leading __ is reserved].board/freescale/common/fsl_can_use.c
Quoted 1 line
board/freescale/common/fsl_can_use.c new file +1
-0+const char *usb_or_esdhc =getenv ("usb_or_esdhc" );Please make it extendable, use a more generic name for one (and only one) environment variable. It makes littel sense to pollyte the envrionment with N additional variables. For example, call it "hwconfig". Allow that this variable holds a list of config settings, separated for example by comma or colon or ...
board/freescale/common/fsl_can_use.c
Quoted 5 lines
board/freescale/common/fsl_can_use.c new file +5
-0+if (!usb_or_esdhc || !strcmp (usb_or_esdhc,"usb" )) +return 1 ; + +if (!strcmp (usb_or_esdhc,"esdhc" )) +return 0 ;This doesn't scale as well. Use a table of known strings and (static inline) function pointers - this is much easier to extend when new options need to get added.
Once we've reached this point, we might even lean back and think which part of this is FSL specific. None, tight? So make this a generic feature and look around which other code can be replaced by it.
Quoted 5 lines
We can probably define both the content of option name / handler function pointer table and the respective handler functions in a board specific file - eventually even the board config file.
That would make for a flexible solution.
Here it is, patches on the way. It's very simple. Just an environment variable, but it should be enough to do what we need currently. I should write some documentation though.
Thanks?
Signature · 3 lines
Anton Vorontsov email: cbouatmailru at gmail.com irc://irc.freenode.net/bd2
PATCH 1/8 Add simple hwconfig infrastructure
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
This is very simple implementation, i.e. it is implemented via `hwconfig' environment variable. Later we could write some "hwconfig <enable|disable|list>" commands, ncurses interface for Award BIOS-like interface, and frame-buffer interface for AMI GUI[1] BIOS-like interface with mouse support[2].
Current implementation details/limitations:
1. Doesn't support options dependencies and mutual exclusion. We can implement this by integrating apt-get[3] into the u-boot. But I didn't bother yet.
2. Since we don't implement hwconfig command, i.e. we're working with the environement directly, there is no way to tell that toggling a particular option will need a reboot to take an effect. So, for now it's advised to always reboot the target after modifying hwconfig variable.
3. We support hwconfig options with arguments. For example,
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
There are three hwconfig options selected:
1. dr_usb - enable Dual-Role USB controller;
2. dr_usb_mode:peripheral - USB in Function mode;
3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.
The purpose of this simple implementation is to define some internal API and then we can continue improving user experience by adding more mature interface, like hwconfig command with bells and whistles. Or not adding, if we feel that current interface fits its needs.
[1] http://en.wikipedia.org/wiki/American_Megatrends
[2] Regarding ncurses and GUI with mouse support -- I'm just kidding.
[3] The comment regarding apt-get is also a joke, meaning that dependency tracking could be non-trivial. For example, for enabling HW feature X we may need to disable Y, and turn Z into reduced mode (like RMII-only interface for ethernet, no MII).
It's quite trivial to implement simple cases though.
--- common/Makefile | 1 + common/hwconfig.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/hwconfig.h | 46 ++++++++++++++++++ 3 files changed, 181 insertions(+), 0 deletions(-) create mode 100644 common/hwconfig.c create mode 100644 include/hwconfig.h
common/Makefile +1 -0
@@ -150,6 +150,7 @@ COBJS-$(CONFIG_VFD) += cmd_vfd.o # others COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o COBJS-$(CONFIG_CMD_DOC) += docecc.o +COBJS-$(CONFIG_HWCONFIG) += hwconfig.o COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o COBJS-y += flash.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
common/hwconfig.c new file +134 -0
134 lines not on this page · raw message
include/hwconfig.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.6.2.2
PATCH 1/8 Add simple hwconfig infrastructure
On Thu, Apr 30, 2009 at 01:50:00AM +0400, Anton Vorontsov wrote:
[..]
Quoted 1 line
+/*
Just noticed that I missed kerneldoc starting comment. It should be /**, will fix.
Signature · 3 lines
Anton Vorontsov email: cbouatmailru at gmail.com irc://irc.freenode.net/bd2
PATCH 1/8 Add simple hwconfig infrastructure
In reply to Anton VorontsovQuoted 22 lines · On Thu, 30 Apr 2009 01:50:00 +0400 Anton Vorontsov <[email protected]>…
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
This is very simple implementation, i.e. it is implemented via `hwconfig' environment variable. Later we could write some "hwconfig <enable|disable|list>" commands, ncurses interface for Award BIOS-like interface, and frame-buffer interface for AMI GUI[1] BIOS-like interface with mouse support[2].
Current implementation details/limitations:
1. Doesn't support options dependencies and mutual exclusion. We can implement this by integrating apt-get[3] into the u-boot. But I didn't bother yet.
2. Since we don't implement hwconfig command, i.e. we're working with the environement directly, there is no way to tell that toggling a particular option will need a reboot to take an effect. So, for now it's advised to always reboot the target after modifying hwconfig variable.
Quoted 3 lines
3. We support hwconfig options with arguments. For example,
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
so a newbie displays his board's environment and sees the above line for the first time. It's not clear whether they will interpret the above as how you would have them:
Quoted 4 lines
There are three hwconfig options selected:
1.dr_usb- enable Dual-Role USB controller;
2. dr_usb_mode:peripheral - USB in Function mode;
3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.
or as something starting along the lines of "dr_usb and/or dr_usb_mode acquire the 'peripheral' setting,..." and then realize "peripheral,dr_usb_phy_type" doesn't make much sense, and have to revert to applying different 'weights' to the comma (,) and colon (:) token separator characters (to a native English speaker, a colon has a higher separation weight than the comma).
May I suggest something more clearer on the outset, such as:
set hwconfig "dr_usb=enable; dr_usb_mode=peripheral; dr_usb_phy_type=ulpi"
or
set hwconfig "usb=dr; dr_usb_mode=peripheral; dr_usb_phy_type=ulpi"
Quoted 9 lines
The purpose of this simple implementation is to define some internal API and then we can continue improving user experience by adding more mature interface, like hwconfig command with bells and whistles. Or not adding, if we feel that current interface fits its needs.
[1] http://en.wikipedia.org/wiki/American_Megatrends
[2] Regarding ncurses and GUI with mouse support -- I'm just kidding.
phew, you had me for a second there :).
Kim
PATCH 1/8 Add simple hwconfig infrastructure
Quoted 45 lines · Kim Phillips
Quoted 22 lines · On Thu, 30 Apr 2009 01:50:00 +0400 Anton Vorontsov <[email protected]>…
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
This is very simple implementation, i.e. it is implemented via `hwconfig' environment variable. Later we could write some "hwconfig <enable|disable|list>" commands, ncurses interface for Award BIOS-like interface, and frame-buffer interface for AMI GUI[1] BIOS-like interface with mouse support[2].
Current implementation details/limitations:
1. Doesn't support options dependencies and mutual exclusion. We can implement this by integrating apt-get[3] into the u-boot. But I didn't bother yet.
2. Since we don't implement hwconfig command, i.e. we're working with the environement directly, there is no way to tell that toggling a particular option will need a reboot to take an effect. So, for now it's advised to always reboot the target after modifying hwconfig variable.
Quoted 3 lines
3. We support hwconfig options with arguments. For example,
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
so a newbie displays his board's environment and sees the above line for the first time. It's not clear whether they will interpret the above as how you would have them:
Quoted 4 lines
There are three hwconfig options selected:
1.dr_usb- enable Dual-Role USB controller;
2. dr_usb_mode:peripheral - USB in Function mode;
3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.or as something starting along the lines of "
dr_usband/ordr_usb_modeacquire the 'peripheral' setting,..." and then realize "peripheral,dr_usb_phy_type" doesn't make much sense, and have to revert to applying different 'weights' to the comma (,) and colon (:) token separator characters (to a native English speaker, a colon has a higher separation weight than the comma).
Quoted 7 lines
May I suggest something more clearer on the outset, such as:
set hwconfig "dr_usb=enable; dr_usb_mode=peripheral; dr_usb_phy_type=ulpi"
or
set hwconfig "usb=dr; dr_usb_mode=peripheral; dr_usb_phy_type=ulpi"
Yes, much more readable. Will implement.
Thanks!
Signature · 3 lines
Anton Vorontsov email: cbouatmailru at gmail.com irc://irc.freenode.net/bd2
PATCH 1/8 Add simple hwconfig infrastructure
In reply to Anton VorontsovDear Anton,
Quoted 2 lines · In message <[email protected]> you wrote:
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
Thanks a lot.
Quoted 8 lines
3. We support hwconfig options with arguments. For example,
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
There are three hwconfig options selected:
1.dr_usb- enable Dual-Role USB controller;
2. dr_usb_mode:peripheral - USB in Function mode;
3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.
That gives a lot of typing, which in turn results in lots of typing errors, which in this case are probably nasty to debug.
Suggestion: instead of
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
use:
set hwconfig dr_usb:mode=peripheral,phy_type=ulpi
What do you think?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Copy from one, it's plagiarism; copy from two, it's research.
PATCH 1/8 Add simple hwconfig infrastructure
Quoted 22 lines · Wolfgang Denk
Dear Anton,
Quoted 2 lines · In message <[email protected]> you wrote:
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
Thanks a lot.
Quoted 8 lines
3. We support hwconfig options with arguments. For example,
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
There are three hwconfig options selected:
1.dr_usb- enable Dual-Role USB controller;
2. dr_usb_mode:peripheral - USB in Function mode;
3. dr_usb_phy_type:ulpi - USB should work with ULPI PHYs.That gives a lot of typing, which in turn results in lots of typing errors, which in this case are probably nasty to debug.
Suggestion: instead of
Quoted 7 lines
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
use:
set hwconfig dr_usb:mode=peripheral,phy_type=ulpi
What do you think?
At first sight this looks great. But where should we stop? I mean, technically that is
dr_usb {
mode = peripheral;
phy_type = ulpi;
};I wonder if we want multi-level nesting capability, i.e.
dr_usb {
mode = peripheral;
phy {
type = ulpi;
clock = 48;
};
};We'd type it this way:
=> set hwconfig "
Quoted 8 lines
dr_usb{
mode = peripheral;
phy {
type = ulpi;
speed = 48;
}
}
"
:-)
Or we can stop at one nesting level capability, just as you describe. Your suggestion is quite easy to implement, but full fledged parser is needed for the most generic case.
Thanks,
Signature · 3 lines
Anton Vorontsov email: cbouatmailru at gmail.com irc://irc.freenode.net/bd2
PATCH 1/8 Add simple hwconfig infrastructure
Dear Anton,
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Suggestion: instead of
set hwconfig dr_usb,dr_usb_mode:peripheral,dr_usb_phy_type:ulpi
Quoted 7 lines
Quoted 5 lines
use:
set hwconfig dr_usb:mode=peripheral,phy_type=ulpi
What do you think?
At first sight this looks great. But where should we stop?
at a semicolon :-) i. e. something like this:
set hwconfig dr_usb:mode=peripheral,phy_type=ulpi;next_option:on;other_option:off
Quoted 9 lines
I wonder if we want multi-level nesting capability, i.e.
dr_usb { mode = peripheral; phy { type = ulpi; clock = 48; }; };
I don't think we should go that far.
Quoted 3 lines
Or we can stop at one nesting level capability, just as you describe. Your suggestion is quite easy to implement, but full fledged parser is needed for the most generic case.
I think this should remain what it was introduced as: a *simple* hwconfig infrastructure.
If you need more capabilities, then we should just use existing code:
use a device tree. OK, then you have to provide the information in a separate flash sector instead of the environment, but in the long run this is the way to go anyway - if you do it right you will need just a single copy of the device tree for both U-Boot and Linux.
So if you need something small and *simple* now, then use hwconfig, but without all theoretically possible bells and whistles; if you need the full-blown thing, trhen use a device tree.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "I've seen it. It's rubbish." - Marvin the Paranoid Android
PATCH 1/8 Add simple hwconfig infrastructure
In reply to Anton VorontsovQuoted 9 lines · Anton Vorontsov
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
This is very simple implementation, i.e. it is implemented via `hwconfig' environment variable. Later we could write some "hwconfig <enable|disable|list>" commands, ncurses interface for Award BIOS-like interface, and frame-buffer interface for AMI GUI[1] BIOS-like interface with mouse support[2].
...Any updates on this? It looks like your eSDHC patches rely on it, so I can't apply any of these 8 patches until this one passes. :)
Andy
PATCH 1/8 Add simple hwconfig infrastructure
Quoted 14 lines · Andy Fleming
Quoted 9 lines · Anton Vorontsov
This patch implements simple hwconfig infrastructure: an interface for software knobs to control a hardware.
This is very simple implementation, i.e. it is implemented via `hwconfig' environment variable. Later we could write some "hwconfig <enable|disable|list>" commands, ncurses interface for Award BIOS-like interface, and frame-buffer interface for AMI GUI[1] BIOS-like interface with mouse support[2].
Quoted 2 lines
...Any updates on this? It looks like your eSDHC patches rely on it, so I can't apply any of these 8 patches until this one passes. :)
Yeah... I've been on a vacation, and then got some internal MV work to do, but now I'm slowly but surely catching up on the pending community work, so I will post updated patches soon.
Thanks,
Signature · 3 lines
Anton Vorontsov email: cbouatmailru at gmail.com irc://irc.freenode.net/bd2
PATCH 2/8 fsl_esdhc: Add device tree fixups
In reply to Anton VorontsovThis patch implements fdt_fixup_esdhc() function that is used to fixup the device tree.
The function adds status = "disabled" propery if esdhc pins muxed away, otherwise it fixups clock-frequency for esdhc nodes.
--- drivers/mmc/fsl_esdhc.c | 22 ++++++++++++++++++++++ include/fsl_esdhc.h | 8 ++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)
drivers/mmc/fsl_esdhc.c +22 -0
@@ -28,11 +28,13 @@#include <config.h> #include <common.h> #include <command.h> +#include <hwconfig.h> #include <mmc.h> #include <part.h> #include <malloc.h> #include <mmc.h> #include <fsl_esdhc.h> +#include <fdt_support.h> #include <asm/io.h>
@@ -346,3 +348,23 @@ int fsl_esdhc_mmc_init(bd_t *bis) {return esdhc_initialize (bis); } + +#ifdef CONFIG_MPC85xx +#define ESDHC_COMPATIBLE "fsl,mpc8536-esdhc" +#else +#define ESDHC_COMPATIBLE "fsl,mpc8379-esdhc" +#endif + +void fdt_fixup_esdhc (void *blob,bd_t *bd) +{ +if (!hwconfig ("esdhc" )) { +const char *reason ="disabled" ; + +do_fixup_by_compat (blob,ESDHC_COMPATIBLE ,"status" , reason, +strlen (reason) +1 ,1 ); +return ; + } + +do_fixup_by_compat_u32 (blob,ESDHC_COMPATIBLE ,"clock-frequency" , + gd->sdhc_clk,1 ); +}
include/fsl_esdhc.h +8 -0
@@ -26,6 +26,8 @@#ifndef __FSL_ESDHC_H__#define __FSL_ESDHC_H__ +#include <asm/errno.h> +/* FSL eSDHC-specific constants */ #define SYSCTL 0x0002e02c#define SYSCTL_INITA 0x08000000
@@ -140,6 +142,12 @@#define ESDHC_HOSTCAPBLT_DMAS 0x00400000#define ESDHC_HOSTCAPBLT_HSS 0x00200000 +#ifdef CONFIG_FSL_ESDHC int fsl_esdhc_mmc_init (bd_t *bis); +void fdt_fixup_esdhc (void *blob,bd_t *bd); +#else +static inline int fsl_esdhc_mmc_init (bd_t *bis) {return -ENOSYS ; } +static inline void fdt_fixup_esdhc (void *blob,bd_t *bd) {} +#endif /* CONFIG_FSL_ESDHC */ #endif /* __FSL_ESDHC_H__ */
Signature · 1 line
1.6.2.2
PATCH 3/8 mpc83xx: MPC837XERDB: Add support for FSL eSDHC
In reply to Anton VorontsovThis patch adds support for eSDHC on MPC837XERDB boards. The WP switch doesn't seem to work on RDB boards though, the WP pin is always asserted (can see the pin state when it's in GPIO mode).
FSL DR USB and FSL eSDHC are mutually exclusive because of pins multiplexing, so user should specify 'esdhc' or 'dr_usb' options in the hwconfig environment variable to choose between the devices.
p.s.
Now we're very close to a monitor len limit (196 bytes left using gcc-4.2.0), so also increase the monitor len by one sector (64 KB).
--- board/freescale/mpc837xerdb/mpc837xerdb.c | 18 ++++++++++++++++++ include/configs/MPC837XERDB.h | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletions(-)
board/freescale/mpc837xerdb/mpc837xerdb.c +18 -0
@@ -13,12 +13,14 @@*/ #include <common.h> +#include <hwconfig.h> #include <i2c.h> #include <asm/io.h> #include <asm/fsl_serdes.h> #include <fdt_support.h> #include <spd_sdram.h> #include <vsc7385.h> +#include <fsl_esdhc.h> #if defined(CONFIG_SYS_DRAM_TEST )int
@@ -166,6 +168,21 @@ int board_early_init_f(void)return 0 ; } +#ifdef CONFIG_FSL_ESDHC +int board_mmc_init (bd_t *bd) +{ +struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR ; + +if (!hwconfig ("esdhc" )) +return 0 ; + +clrsetbits_be32 (&im->sysconf.sicrl,SICRL_USB_B ,SICRL_USB_B_SD ); +clrsetbits_be32 (&im->sysconf.sicrh,SICRH_SPI ,SICRH_SPI_SD ); + +return fsl_esdhc_mmc_init (bd); +} +#endif +/* * Miscellaneous late-boot configurations *
@@ -195,5 +212,6 @@ void ft_board_setup(void *blob, bd_t *bd)#endif ft_cpu_setup (blob, bd);fdt_fixup_dr_usb (blob, bd); + fdt_fixup_esdhc(blob, bd); }#endif /* CONFIG_OF_BOARD_SETUP */
include/configs/MPC837XERDB.h +17 -1
@@ -34,6 +34,7 @@#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_MISC_INIT_R +#define CONFIG_HWCONFIG /* * On-board devices
@@ -228,7 +229,7 @@#undef CONFIG_SYS_RAMBOOT#endif -#define CONFIG_SYS_MONITOR_LEN (256 * 1024)/* Reserve 256 kB for Mon */ +#define CONFIG_SYS_MONITOR_LEN (320 * 1024)/* Reserve 320 kB for Mon */ #define CONFIG_SYS_MALLOC_LEN (512 * 1024)/* Reserved for malloc */ /*
@@ -342,6 +343,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_SYS_64BIT_STRTOUL 1 +#define CONFIG_SYS_64BIT_VSPRINTF 1 +/* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ #undef CONFIG_SOFT_I2C/* I2C bit-banged */
@@ -510,6 +514,18 @@#undef CONFIG_WATCHDOG/* watchdog disabled */ +#define CONFIG_MMC 1 + +#ifdef CONFIG_MMC +#define CONFIG_FSL_ESDHC +#define CONFIG_SYS_FSL_ESDHC_ADDR CONFIG_SYS_MPC83xx_ESDHC_ADDR +#define CONFIG_CMD_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT +#define CONFIG_DOS_PARTITION +#endif +/* * Miscellaneous configurable options */
Signature · 1 line
1.6.2.2
PATCH 4/8 mpc83xx: MPC837XEMDS: Fixup eSDHC nodes in device tree
In reply to Anton Vorontsovfdt_fixup_esdhc() will either disable or enable eSDHC nodes, and also will fixup clock-frequency property.
Plus, since DR USB and eSDHC are mutually exclusive, we should only configure the eSDHC if asked through hwconfig.
--- board/freescale/mpc837xemds/mpc837xemds.c | 37 ++++++++++++++++++---------- include/configs/MPC837XEMDS.h | 1 + 2 files changed, 25 insertions(+), 13 deletions(-)
board/freescale/mpc837xemds/mpc837xemds.c +24 -13
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <hwconfig.h> #include <i2c.h> #include <asm/io.h> #include <asm/fsl_serdes.h>
@@ -18,12 +19,12 @@#include <tsec.h> #include <libfdt.h> #include <fdt_support.h> +#include <fsl_esdhc.h> #include "pci.h" #include "../common/pq-mds-pib.h" int board_early_init_f (void ) { -struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR ;u8 *bcsr = (u8 *)CONFIG_SYS_BCSR ;/* Enable flash write */
@@ -31,18 +32,6 @@ int board_early_init_f(void)/* Clear all of the interrupt of BCSR */ bcsr[0xe ] =0xff ; -#ifdef CONFIG_MMC -/* Set SPI_SD, SER_SD, and IRQ4_WP so that SD signals go through */ - bcsr[0xc ] |=0x4c ; - -/* Set proper bits in SICR to allow SD signals through */ -clrsetbits_be32 (&im->sysconf.sicrl,SICRL_USB_B ,SICRL_USB_B_SD ); - -clrsetbits_be32 (&im->sysconf.sicrh, (SICRH_GPIO2_E |SICRH_SPI ), - (SICRH_GPIO2_E_SD |SICRH_SPI_SD )); - -#endif -#ifdef CONFIG_FSL_SERDES immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ;u32 spridr =in_be32 (&immr->sysconf.spridr);
@@ -72,6 +61,27 @@ int board_early_init_f(void)return 0 ; } +#ifdef CONFIG_FSL_ESDHC +int board_mmc_init (bd_t *bd) +{ +struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR ; +u8 *bcsr = (u8 *)CONFIG_SYS_BCSR ; + +if (!hwconfig ("esdhc" )) +return 0 ; + +/* Set SPI_SD, SER_SD, and IRQ4_WP so that SD signals go through */ + bcsr[0xc ] |=0x4c ; + +/* Set proper bits in SICR to allow SD signals through */ +clrsetbits_be32 (&im->sysconf.sicrl,SICRL_USB_B ,SICRL_USB_B_SD ); +clrsetbits_be32 (&im->sysconf.sicrh,SICRH_GPIO2_E |SICRH_SPI , +SICRH_GPIO2_E_SD |SICRH_SPI_SD ); + +return fsl_esdhc_mmc_init (bd); +} +#endif +#if defined(CONFIG_TSEC1 ) || defined(CONFIG_TSEC2 )int board_eth_init (bd_t *bd) {
@@ -322,6 +332,7 @@ void ft_board_setup(void *blob, bd_t *bd)ft_cpu_setup (blob, bd);ft_tsec_fixup (blob, bd);fdt_fixup_dr_usb (blob, bd); +fdt_fixup_esdhc (blob, bd);#ifdef CONFIG_PCI ft_pci_setup (blob, bd);if (board_pci_host_broken ())
include/configs/MPC837XEMDS.h +1 -0
@@ -111,6 +111,7 @@#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ #define CONFIG_BOARD_EARLY_INIT_R +#define CONFIG_HWCONFIG /* * IMMR new address
Signature · 1 line
1.6.2.2
PATCH 5/8 fdt_support, usb: Move fdt_fixup_dr_usb routine to drivers/usb/otg
In reply to Anton VorontsovIn subsequent patches we'll use FSL-specific functions in fdt_fixup_dr_usb(), so let's move the routine to a more appropriate place.
So far fsl_dr_usb.c isn't actually an USB driver, but eventually it will turn into one, let's hope. ;-)
Also rename CONFIG_HAS_FSL_DR_USB to CONFIG_USB_FSL_DR to be consistent with other USB drivers.
--- Makefile | 1 + board/freescale/mpc8315erdb/mpc8315erdb.c | 1 + board/freescale/mpc837xemds/mpc837xemds.c | 1 + board/freescale/mpc837xerdb/mpc837xerdb.c | 1 + common/fdt_support.c | 41 ---------------------- drivers/usb/otg/Makefile | 46 +++++++++++++++++++++++++ drivers/usb/otg/fsl_dr_usb.c | 52 +++++++++++++++++++++++++++++ include/configs/MPC8315ERDB.h | 2 +- include/configs/MPC837XEMDS.h | 2 +- include/configs/MPC837XERDB.h | 2 +- include/fdt_support.h | 6 --- include/fsl_dr_usb.h | 21 +++++++++++ 12 files changed, 126 insertions(+), 50 deletions(-) create mode 100644 drivers/usb/otg/Makefile create mode 100644 drivers/usb/otg/fsl_dr_usb.c create mode 100644 include/fsl_dr_usb.h
Makefile +1 -0
@@ -265,6 +265,7 @@ LIBS += drivers/serial/libserial.a LIBS += drivers/twserial/libtws.a LIBS += drivers/usb/gadget/libusb_gadget.a LIBS += drivers/usb/host/libusb_host.a +LIBS += drivers/usb/otg/libusb_otg.a LIBS += drivers/usb/musb/libusb_musb.a LIBS += drivers/video/libvideo.a LIBS += drivers/watchdog/libwatchdog.a
board/freescale/mpc8315erdb/mpc8315erdb.c +1 -0
@@ -30,6 +30,7 @@#include <pci.h> #include <mpc83xx.h> #include <netdev.h> +#include <fsl_dr_usb.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ;
board/freescale/mpc837xemds/mpc837xemds.c +1 -0
@@ -20,6 +20,7 @@#include <libfdt.h> #include <fdt_support.h> #include <fsl_esdhc.h> +#include <fsl_dr_usb.h> #include "pci.h" #include "../common/pq-mds-pib.h"
board/freescale/mpc837xerdb/mpc837xerdb.c +1 -0
@@ -21,6 +21,7 @@#include <spd_sdram.h> #include <vsc7385.h> #include <fsl_esdhc.h> +#include <fsl_dr_usb.h> #if defined(CONFIG_SYS_DRAM_TEST )int
common/fdt_support.c +0 -41
47 lines not on this page · raw message
drivers/usb/otg/Makefile new file +46 -0
46 lines not on this page · raw message
drivers/usb/otg/fsl_dr_usb.c new file +52 -0
52 lines not on this page · raw message
include/configs/MPC8315ERDB.h +1 -1
@@ -344,7 +344,7 @@#define CONFIG_NET_MULTI 1#endif -#define CONFIG_HAS_FSL_DR_USB +#define CONFIG_USB_FSL_DR 1/* * TSEC
include/configs/MPC837XEMDS.h +1 -1
@@ -385,7 +385,7 @@ extern int board_pci_host_broken(void);#define CONFIG_83XX_GENERIC_PCIE 1#define CONFIG_PQ_MDS_PIB 1/* PQ MDS Platform IO Board */ -#define CONFIG_HAS_FSL_DR_USB 1/* fixup device tree for the DR USB */ +#define CONFIG_USB_FSL_DR 1/* fixup device tree for the DR USB */ #define CONFIG_NET_MULTI #define CONFIG_PCI_PNP /* do pci plug-and-play */
include/configs/MPC837XERDB.h +1 -1
@@ -654,7 +654,7 @@#define CONFIG_ETH1ADDR 00:04:9f:ef:04:02#endif -#define CONFIG_HAS_FSL_DR_USB +#define CONFIG_USB_FSL_DR 1#define CONFIG_IPADDR 10.0.0.2#define CONFIG_SERVERIP 10.0.0.1
include/fdt_support.h +0 -6
@@ -53,12 +53,6 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create);void fdt_fixup_qe_firmware (void *fdt); -#ifdef CONFIG_HAS_FSL_DR_USB -void fdt_fixup_dr_usb (void *blob,bd_t *bd); -#else -static inline void fdt_fixup_dr_usb (void *blob,bd_t *bd) {} -#endif /* CONFIG_HAS_FSL_DR_USB */ -#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC83XX )void fdt_fixup_crypto_node (void *blob,int sec_rev);#else
include/fsl_dr_usb.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (c) 2008-2009 MontaVista Software, Inc. +* +* Author: Anton Vorontsov <[email protected]> +* +* 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. +*/ + +#ifndef __DR_USB_H +#define __DR_USB_H + +#ifdef CONFIG_USB_FSL_DR +void fdt_fixup_dr_usb (void *blob,bd_t *bd); +#else +static inline void fdt_fixup_dr_usb (void *blob,bd_t *bd) {} +#endif + +#endif /* __DR_USB_H */
Signature · 1 line
1.6.2.2
PATCH 6/8 fsl_dr_usb: Fixup disabled USB controllers nodes in device tree
In reply to Anton VorontsovWe should add status = "disabled" property when USB controller can't be used (for example when USB pins muxed away to another device).
Also convert whole fdt_fixup_dr_usb() to use more compact routines from fdt_support.h.
--- cpu/mpc83xx/cpu.c | 4 +++ drivers/usb/otg/fsl_dr_usb.c | 60 ++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 25 deletions(-)
cpu/mpc83xx/cpu.c +4 -0
@@ -404,6 +404,10 @@ int cpu_mmc_init(bd_t *bis)#endif } +#ifdef CONFIG_HWCONFIG +const char *cpu_hwconfig ="dr_usb" ; +#endif +#ifdef CONFIG_BOOTCOUNT_LIMIT #if !defined(CONFIG_MPC8360 )
drivers/usb/otg/fsl_dr_usb.c +35 -25
78 lines not on this page · raw message
Signature · 1 line
1.6.2.2
PATCH 7/8 mpc83xx: MPC8315ERDB: Use hwconfig for board type selection
In reply to Anton VorontsovThis patch simply converts the board to the hwconfig infrastructure.
--- board/freescale/mpc8315erdb/mpc8315erdb.c | 14 +++++--------- include/configs/MPC8315ERDB.h | 1 + 2 files changed, 6 insertions(+), 9 deletions(-)
board/freescale/mpc8315erdb/mpc8315erdb.c +5 -9
@@ -24,6 +24,7 @@*/ #include <common.h> +#include <hwconfig.h> #include <i2c.h> #include <libfdt.h> #include <fdt_support.h>
@@ -177,20 +178,15 @@ void pci_init_board(void)#if defined(CONFIG_OF_BOARD_SETUP )void fdt_tsec1_fixup (void *fdt,bd_t *bd) { -char *mpc8315erdb =getenv ("mpc8315erdb" );const char disabled[] ="disabled" ;const char *path;int ret; -if (!mpc8315erdb) +if (hwconfig_arg_cmp ("board_type" ,"tsec1" )) {return ; - -if (!strcmp (mpc8315erdb,"tsec1" )) { -return ; - }else if (strcmp (mpc8315erdb,"ulpi" )) { -printf ("WARNING: wrong `mpc8315erdb' environment " -"variable specified: `%s'. Should be `ulpi' " -"or `tsec1'.\n" , mpc8315erdb); + }else if (!hwconfig_arg_cmp ("board_type" ,"ulpi" )) { +printf ("NOTICE: No or unknown board_type hwconfig specified.\n" +" Assuming board with TSEC1.\n" );return ; }
include/configs/MPC8315ERDB.h +1 -0
@@ -72,6 +72,7 @@#define CONFIG_SYS_SICRL 0x00000000/* 3.3V, no delay */ #define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_HWCONFIG /* * IMMR new address
Signature · 1 line
1.6.2.2
PATCH 8/8 mpc83xx: MPC837xEMDS: Use hwconfig instead of pci_external_arbiter variable
In reply to Anton VorontsovSince we have simple hwconfig interface now, we don't need pci_external_arbiter variable any longer.
--- board/freescale/mpc837xemds/mpc837xemds.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
board/freescale/mpc837xemds/mpc837xemds.c +1 -2
@@ -293,10 +293,9 @@ int board_pci_host_broken(void) {struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR ;const u32 rcw_mask =HRCWH_PCI1_ARBITER_ENABLE |HRCWH_PCI_HOST ; -const char *pci_ea =getenv ("pci_external_arbiter" );/* It's always OK in case of external arbiter. */ -if (pci_ea && !strcmp (pci_ea,"yes" )) +if (hwconfig_arg_cmp ("pci_arbiter" ,"external" ))return 0 ;if ((in_be32 (&im->reset.rcwh) & rcw_mask) != rcw_mask)
Signature · 1 line
1.6.2.2