Re: [U-Boot] [PATCH 00/30] dm: Add driver-model support for block drivers
Hi Tom, On 15 February 2016 at 15:37, Tom Rini wrote: > On Sun, Feb 14, 2016 at 07:16:29PM -0700, Simon Glass wrote: > >> Recent additions of the MMC and DISK uclasses have indicated that it is time >> to look at adding a uclass for block devices. This series does this and >> includes a few clean-ups to the partition code also. >> >> A block device is typically a child device of its storage parent. For >> example an MMC device will have a block-device child. A USB storage device >> may have multiple block-device children, one for each LUN. >> >> With this series only USB storage and 'host' are converted over to use the >> new support. Several more remain, including SCSI, IDE and MMC. Each of these >> should get its own uclass. >> >> The uclass implements only a few basic features. A few tests are added to >> check that things work as expected. >> >> The code size impact of switching to driver model for block devices is >> small. One benefit is that it becomes possible to enumerate all block >> devices, regardless of their type. > > Things generally make sense. I've tossed out a few Reviewed-by's for > some things but I looked over everything. My only question is have you > run buildman -S and compared the numbers, especially for things that > aren't opting in yet? A few oddballs have been spotted by that already > :) Yes I found quite a few problems that way. There was SPL code bloat and also general bloat with more code being linked in than before. But I believe all of that was fixed. Let me know if you see anything though. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 00/30] dm: Add driver-model support for block drivers
Hi Stephen, On 16 February 2016 at 16:43, Stephen Warren wrote: > On 02/14/2016 07:16 PM, Simon Glass wrote: >> >> Recent additions of the MMC and DISK uclasses have indicated that it is >> time >> to look at adding a uclass for block devices. This series does this and >> includes a few clean-ups to the partition code also. >> >> A block device is typically a child device of its storage parent. For >> example an MMC device will have a block-device child. A USB storage device >> may have multiple block-device children, one for each LUN. >> >> With this series only USB storage and 'host' are converted over to use the >> new support. Several more remain, including SCSI, IDE and MMC. Each of >> these >> should get its own uclass. >> >> The uclass implements only a few basic features. A few tests are added to >> check that things work as expected. >> >> The code size impact of switching to driver model for block devices is >> small. One benefit is that it becomes possible to enumerate all block >> devices, regardless of their type. > > > This series looks OK, and I would give it an Acked-by, except that it seems > to break DFU to SD card on the 3 systems where I'm running test/py, and even > cause "dhcp" to fail on one of them (that could be either memory corruption > caused by these patches, or pre-existing corruption that these patches > shuffle around in memory so it only now causes a problem). I'll see if I can > bisect these down to a specific patch in the series and see what's up. It sounds like you found the bug there, and I'll include the fix in v2. Thanks very much for testing this. I will try to get it in very early in the merge window as it is risky. But your automated tests are a big comfort. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] RFC: rockchip: video: Lower hpd wait time
Waiting 30 seconds for the hpd to go high seems a bit much, especially on headless boots. Lowering the timeout to 300ms. Sending as RFC because frankly i don't know what a sensible timeout is here, but 30 seconds is clearly not it :) Signed-off-by: Sjoerd Simons --- drivers/video/rockchip/rk_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/rockchip/rk_hdmi.c b/drivers/video/rockchip/rk_hdmi.c index 5fcb61a..8805c77 100644 --- a/drivers/video/rockchip/rk_hdmi.c +++ b/drivers/video/rockchip/rk_hdmi.c @@ -666,7 +666,7 @@ static int hdmi_wait_for_hpd(struct rk3288_hdmi *regs) if (hdmi_get_plug_in_status(regs)) return 0; udelay(100); - } while (get_timer(start) < 3); + } while (get_timer(start) < 300); return -1; } -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 07/12] net: gmac_rk3288: Add RK3288 GMAC driver
Add a new driver for the GMAC ethernet interface present in Rockchip RK3288 SOCs. This driver subclasses the generic design-ware driver to add the glue needed specifically for Rockchip. Signed-off-by: Sjoerd Simons --- Changes in v2: - Fix various coding style nits - Adjust to new hook name drivers/net/Kconfig | 7 +++ drivers/net/Makefile | 1 + drivers/net/gmac_rk3288.c | 125 ++ 3 files changed, 133 insertions(+) create mode 100644 drivers/net/gmac_rk3288.c diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index bc2f51d..fa49856 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -133,4 +133,11 @@ config PIC32_ETH This driver implements 10/100 Mbps Ethernet and MAC layer for Microchip PIC32 microcontrollers. +config GMAC_RK3288 + bool "Rockchip RK3288 Synopsys Designware Ethernet MAC" + depends on DM_ETH && ETH_DESIGNWARE + help + This driver provides Rockchip RK3288 network support based on the + Synopsys Designware driver. + endif # NETDEVICES diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 33a81ee..d0a8009 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_FTGMAC100) += ftgmac100.o obj-$(CONFIG_FTMAC110) += ftmac110.o obj-$(CONFIG_FTMAC100) += ftmac100.o obj-$(CONFIG_GRETH) += greth.o +obj-$(CONFIG_GMAC_RK3288) += gmac_rk3288.o obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o obj-$(CONFIG_LAN91C96) += lan91c96.o diff --git a/drivers/net/gmac_rk3288.c b/drivers/net/gmac_rk3288.c new file mode 100644 index 000..5400b2c --- /dev/null +++ b/drivers/net/gmac_rk3288.c @@ -0,0 +1,125 @@ +/* + * (C) Copyright 2015 Sjoerd Simons + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +/* * Rockchip GMAC ethernet IP driver for U-Boot */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "designware.h" +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct gmac_rk3288_platdata { + struct dw_eth_pdata dw_eth_pdata; + int tx_delay; + int rx_delay; +}; + +static int gmac_rk3288_ofdata_to_platdata(struct udevice *dev) +{ + struct gmac_rk3288_platdata *pdata = dev_get_platdata(dev); + + pdata->tx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset, +"tx_delay", 0x30); + pdata->rx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset, +"rx_delay", 0x10); + + return designware_eth_ofdata_to_platdata(dev); +} + +static int gmac_rk3288_fix_mac_speed(struct dw_eth_dev *priv) +{ + struct rk3288_grf *grf; + int clk; + + switch (priv->phydev->speed) { + case 10: + clk = GMAC_CLK_SEL_2_5M; + break; + case 100: + clk = GMAC_CLK_SEL_25M; + break; + case 1000: + clk = GMAC_CLK_SEL_125M; + break; + default: + printf("Unknown phy speed: %d\n", priv->phydev->speed); + return -EINVAL; + } + + grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); + + rk_clrsetreg(&grf->soc_con1, +GMAC_CLK_SEL_MASK << GMAC_CLK_SEL_SHIFT, +clk << GMAC_CLK_SEL_SHIFT); + + return 0; +} + +static int gmac_rk3288_probe(struct udevice *dev) +{ + int ret; + struct gmac_rk3288_platdata *pdata = dev_get_platdata(dev); + struct dw_eth_dev *priv = dev_get_priv(dev); + struct rk3288_grf *grf; + struct udevice *clk; + + + ret = uclass_get_device(UCLASS_CLK, CLK_GENERAL, &clk); + if (ret) + return ret; + + ret = clk_set_periph_rate(clk, SCLK_MAC, 0); + if (ret) + return ret; + + /* Set to RGMII mode */ + grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); + rk_clrsetreg(&grf->soc_con1, +RMII_MODE_MASK << RMII_MODE_SHIFT | +GMAC_PHY_INTF_SEL_MASK << GMAC_PHY_INTF_SEL_SHIFT, +GMAC_PHY_INTF_SEL_RGMII << GMAC_PHY_INTF_SEL_SHIFT); + + rk_clrsetreg(&grf->soc_con3, +RXCLK_DLY_ENA_GMAC_MASK << RXCLK_DLY_ENA_GMAC_SHIFT | +TXCLK_DLY_ENA_GMAC_MASK << TXCLK_DLY_ENA_GMAC_SHIFT | +CLK_RX_DL_CFG_GMAC_MASK << CLK_RX_DL_CFG_GMAC_SHIFT | +CLK_TX_DL_CFG_GMAC_MASK << CLK_TX_DL_CFG_GMAC_SHIFT, +RXCLK_DLY_ENA_GMAC_ENABLE << RXCLK_DLY_ENA_GMAC_SHIFT | +TXCLK_DLY_ENA_GMAC_ENABLE << TXCLK_DLY_ENA_GMAC_SHIFT | +pdata->rx_delay << CLK_RX_DL_CFG_GMAC_SHIFT | +pdata->tx_delay << CLK_TX_DL_CFG_GMAC_SHIFT); + + priv->fix_mac_speed = gmac_rk3288_fix_mac_speed; + + return designware_eth_probe(dev); +} + +static const
[U-Boot] [PATCH v2 06/12] rockchip: rk3288: grf: Define GRF_SOC_CON1 and GRF_SOC_CON3
Add definitions for GRF_SOC_CON1 and GRF_SOC_CON3 which contain various GMAC related fields. Signed-off-by: Sjoerd Simons --- Changes in v2: None arch/arm/include/asm/arch-rockchip/grf_rk3288.h | 53 + 1 file changed, 53 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3288.h b/arch/arm/include/asm/arch-rockchip/grf_rk3288.h index 0117a17..aaffd19 100644 --- a/arch/arm/include/asm/arch-rockchip/grf_rk3288.h +++ b/arch/arm/include/asm/arch-rockchip/grf_rk3288.h @@ -718,6 +718,40 @@ enum { MSCH0_MAINPARTIALPOP_MASK = 1, }; +/* GRF_SOC_CON1 */ +enum { + RMII_MODE_SHIFT = 0xe, + RMII_MODE_MASK = 1, + RMII_MODE = 1, + + GMAC_CLK_SEL_SHIFT = 0xc, + GMAC_CLK_SEL_MASK = 3, + GMAC_CLK_SEL_125M = 0, + GMAC_CLK_SEL_25M= 0x3, + GMAC_CLK_SEL_2_5M = 0x2, + + RMII_CLK_SEL_SHIFT = 0xb, + RMII_CLK_SEL_MASK = 1, + RMII_CLK_SEL_2_5M = 0, + RMII_CLK_SEL_25M, + + GMAC_SPEED_SHIFT= 0xa, + GMAC_SPEED_MASK = 1, + GMAC_SPEED_10M = 0, + GMAC_SPEED_100M, + + GMAC_FLOWCTRL_SHIFT = 0x9, + GMAC_FLOWCTRL_MASK = 1, + + GMAC_PHY_INTF_SEL_SHIFT = 0x6, + GMAC_PHY_INTF_SEL_MASK = 0x7, + GMAC_PHY_INTF_SEL_RGMII = 0x1, + GMAC_PHY_INTF_SEL_RMII = 0x4, + + HOST_REMAP_SHIFT= 0x5, + HOST_REMAP_MASK = 1 +}; + /* GRF_SOC_CON2 */ enum { UPCTL1_LPDDR3_ODT_EN_SHIFT = 0xd, @@ -765,4 +799,23 @@ enum { PWM_PWM = 0, }; +/* GRF_SOC_CON3 */ +enum { + RXCLK_DLY_ENA_GMAC_SHIFT= 0xf, + RXCLK_DLY_ENA_GMAC_MASK = 1, + RXCLK_DLY_ENA_GMAC_DISABLE = 0, + RXCLK_DLY_ENA_GMAC_ENABLE, + + TXCLK_DLY_ENA_GMAC_SHIFT= 0xe, + TXCLK_DLY_ENA_GMAC_MASK = 1, + TXCLK_DLY_ENA_GMAC_DISABLE = 0, + TXCLK_DLY_ENA_GMAC_ENABLE, + + CLK_RX_DL_CFG_GMAC_SHIFT= 0x7, + CLK_RX_DL_CFG_GMAC_MASK = 0x7f, + + CLK_TX_DL_CFG_GMAC_SHIFT= 0x0, + CLK_TX_DL_CFG_GMAC_MASK = 0x7f, +}; + #endif -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 00/12] Add support for Rockchip RK3288 Ethernet
Second round to add support for the GMAC Ethernet interface on RK3288 SoCs. I had hope to follow up a lot earlier, but things were bussier then expected :( To add support I've taken a slightly different approach then some of the other boards with a designware IP block, by creating a new driver to take care of the platfrom glue which subclasses the main designware driver instead of adding the compatibility string the designware driver directly and doing the SoC specific setup in the board files. This seems quite a bit more elegant in a device model based world. I've only tested this series on a Radxa Rock 2 board, it would be great if someone could test this on other boards with the designware IP especially for those with the reset GPIO in devicetree (e.g. some of the Allwinner boards). Compared to the first one round the pinctrl related bits were dropped as RK3288 now has a full pinctrl driver. Furthermore the started hook in the designware driver was renamed to fix_mac_speed in line with what linux uses and moved to the dw_link_adjust function. Changes in v2: - Store probe gpio in private data not platdata - Drop unneeded header file - Move the hook into the dw_adjust_link function - Rename the hook to fix_mac_speed, similar to Linux - Fix various coding style nits - Adjust to new hook name Sjoerd Simons (12): net: designware: support phy reset device-tree bindings net: designware: Export various functions/struct to allow subclassing net: designware: Add a fix_mac_speed hook rockchip: rk3288: pinctrl: support more pins rockchip: rk3288: Add clock support for the gmac ethernet interface rockchip: rk3288: grf: Define GRF_SOC_CON1 and GRF_SOC_CON3 net: gmac_rk3288: Add RK3288 GMAC driver rockchip: rk3288-firefly: Add gmac definition rockchip: rock2: dts: use status = "okay" not ok rockchip: Enable networking support on rock2 and firefly rockchip: Add PXE and DHCP to the default boot targets rockchip: Drop Ethernet from the TODO arch/arm/dts/rk3288-firefly.dtsi| 16 +++ arch/arm/dts/rk3288-rock2-square.dts| 2 +- arch/arm/include/asm/arch-rockchip/cru_rk3288.h | 17 arch/arm/include/asm/arch-rockchip/grf_rk3288.h | 53 ++ configs/firefly-rk3288_defconfig| 5 + configs/rock2_defconfig | 5 + doc/README.rockchip | 1 - drivers/clk/clk_rk3288.c| 14 +++ drivers/net/Kconfig | 7 ++ drivers/net/Makefile| 1 + drivers/net/designware.c| 90 ++--- drivers/net/designware.h| 18 drivers/net/gmac_rk3288.c | 125 drivers/pinctrl/rockchip/pinctrl_rk3288.c | 2 +- include/configs/rk3288_common.h | 4 +- 15 files changed, 345 insertions(+), 15 deletions(-) create mode 100644 drivers/net/gmac_rk3288.c -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 05/12] rockchip: rk3288: Add clock support for the gmac ethernet interface
Setup the clocks for the gmac ethernet interface. This assumes the mac clock is fed by an external clock which is common on RK3288 based devices. Signed-off-by: Sjoerd Simons --- Changes in v2: None arch/arm/include/asm/arch-rockchip/cru_rk3288.h | 17 + drivers/clk/clk_rk3288.c| 14 ++ 2 files changed, 31 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3288.h b/arch/arm/include/asm/arch-rockchip/cru_rk3288.h index d2690c7..8a8ca9c 100644 --- a/arch/arm/include/asm/arch-rockchip/cru_rk3288.h +++ b/arch/arm/include/asm/arch-rockchip/cru_rk3288.h @@ -90,6 +90,23 @@ enum { SDIO0_DIV_MASK = 0x3f, }; +/* CRU_CLKSEL21_CON */ +enum { + MAC_DIV_CON_SHIFT = 0xf, + MAC_DIV_CON_MASK = 0x1f, + + RMII_EXTCLK_SHIFT = 4, + RMII_EXTCLK_MASK = 1, + RMII_EXTCLK_SELECT_INT_DIV_CLK = 0, + RMII_EXTCLK_SELECT_EXT_CLK = 1, + + EMAC_PLL_SHIFT = 0, + EMAC_PLL_MASK = 0x3, + EMAC_PLL_SELECT_NEW = 0x0, + EMAC_PLL_SELECT_CODEC = 0x1, + EMAC_PLL_SELECT_GENERAL = 0x2, +}; + /* CRU_CLKSEL25_CON */ enum { SPI1_PLL_SHIFT = 0xf, diff --git a/drivers/clk/clk_rk3288.c b/drivers/clk/clk_rk3288.c index 2a85e93..a110a1c 100644 --- a/drivers/clk/clk_rk3288.c +++ b/drivers/clk/clk_rk3288.c @@ -326,6 +326,17 @@ static int pll_para_config(ulong freq_hz, struct pll_div *div, uint *ext_div) return 0; } +static int rockchip_mac_set_clk(struct rk3288_cru *cru, + int periph, uint freq) +{ + /* Assuming mac_clk is fed by an external clock */ + rk_clrsetreg(&cru->cru_clksel_con[21], +RMII_EXTCLK_MASK << RMII_EXTCLK_SHIFT, +RMII_EXTCLK_SELECT_EXT_CLK << RMII_EXTCLK_SHIFT); + +return 0; +} + static int rockchip_vop_set_clk(struct rk3288_cru *cru, struct rk3288_grf *grf, int periph, unsigned int rate_hz) { @@ -759,6 +770,9 @@ static ulong rk3288_set_periph_rate(struct udevice *dev, int periph, ulong rate) new_rate = rockchip_spi_set_clk(cru, gclk_rate, periph, rate); break; #ifndef CONFIG_SPL_BUILD + case SCLK_MAC: + new_rate = rockchip_mac_set_clk(priv->cru, periph, rate); + break; case DCLK_VOP0: case DCLK_VOP1: new_rate = rockchip_vop_set_clk(cru, priv->grf, periph, rate); -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 08/12] rockchip: rk3288-firefly: Add gmac definition
Add a definition for the gmac interface to the firefly device-tree. Copied verbatim from the linux kernel. Signed-off-by: Sjoerd Simons Acked-by: Simon Glass --- Changes in v2: None arch/arm/dts/rk3288-firefly.dtsi | 16 1 file changed, 16 insertions(+) diff --git a/arch/arm/dts/rk3288-firefly.dtsi b/arch/arm/dts/rk3288-firefly.dtsi index 5aec1b8..072eaa6 100644 --- a/arch/arm/dts/rk3288-firefly.dtsi +++ b/arch/arm/dts/rk3288-firefly.dtsi @@ -146,6 +146,22 @@ status = "okay"; }; +&gmac { + assigned-clocks = <&cru SCLK_MAC>; + assigned-clock-parents = <&ext_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>, <&phy_rst>, <&phy_pmeb>, <&phy_int>; + phy-supply = <&vcc_lan>; + phy-mode = "rgmii"; + snps,reset-active-low; + snps,reset-delays-us = <0 1 100>; + snps,reset-gpio = <&gpio4 8 GPIO_ACTIVE_LOW>; + tx_delay = <0x30>; + rx_delay = <0x10>; + status = "okay"; +}; + &hdmi { ddc-i2c-bus = <&i2c5>; status = "okay"; -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 12/12] rockchip: Drop Ethernet from the TODO
Now that ethernet support works, it can be dropped from the rockchip TODO Signed-off-by: Sjoerd Simons Acked-by: Simon Glass --- Changes in v2: None doc/README.rockchip | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/README.rockchip b/doc/README.rockchip index e0572c8..3ce12d3 100644 --- a/doc/README.rockchip +++ b/doc/README.rockchip @@ -177,7 +177,6 @@ Immediate priorities are: - USB host - USB device - Run CPU at full speed (code exists but we only see ~60 DMIPS maximum) -- Ethernet - NAND flash - Support for other Rockchip parts - Boot U-Boot proper over USB OTG (at present only SPL works) -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 04/12] rockchip: rk3288: pinctrl: support more pins
The rgmii_pins node in rk3288.dtsi configures 15 pins. Increase the size of the cell array to accomedate that, otherwise only the first 10 get configured. Signed-off-by: Sjoerd Simons --- Changes in v2: None drivers/pinctrl/rockchip/pinctrl_rk3288.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3288.c b/drivers/pinctrl/rockchip/pinctrl_rk3288.c index 7c769bd..1fa1daa 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3288.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3288.c @@ -623,7 +623,7 @@ static int rk3288_pinctrl_set_state(struct udevice *dev, struct udevice *config) { const void *blob = gd->fdt_blob; int pcfg_node, ret, flags, count, i; - u32 cell[40], *ptr; + u32 cell[60], *ptr; debug("%s: %s %s\n", __func__, dev->name, config->name); ret = fdtdec_get_int_array_count(blob, config->of_offset, -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 09/12] rockchip: rock2: dts: use status = "okay" not ok
u-boot only recognize okay to enable a node (Linux seems to be more lenient here). So use okay instead. Signed-off-by: Sjoerd Simons --- Changes in v2: None arch/arm/dts/rk3288-rock2-square.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/rk3288-rock2-square.dts b/arch/arm/dts/rk3288-rock2-square.dts index 8d7446f..34073c9 100644 --- a/arch/arm/dts/rk3288-rock2-square.dts +++ b/arch/arm/dts/rk3288-rock2-square.dts @@ -111,7 +111,7 @@ }; &gmac { - status = "ok"; + status = "okay"; }; &hdmi { -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 03/12] net: designware: Add a fix_mac_speed hook
Add the ability for e.g. drivers subclassing to register a function to be called after phy link negotiation. This is useful if e.g. the driver needs to change the mac configuration based on the negotiated speed. Signed-off-by: Sjoerd Simons --- Changes in v2: - Move the hook into the dw_adjust_link function - Rename the hook to fix_mac_speed, similar to Linux drivers/net/designware.c | 8 ++-- drivers/net/designware.h | 4 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 8834506..5eaa1de 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -231,7 +231,8 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id) return 0; } -static void dw_adjust_link(struct eth_mac_regs *mac_p, +static void dw_adjust_link(struct dw_eth_dev *priv, + struct eth_mac_regs *mac_p, struct phy_device *phydev) { u32 conf = readl(&mac_p->conf) | FRAMEBURSTENABLE | DISABLERXOWN; @@ -257,6 +258,9 @@ static void dw_adjust_link(struct eth_mac_regs *mac_p, printf("Speed: %d, %s duplex%s\n", phydev->speed, (phydev->duplex) ? "full" : "half", (phydev->port == PORT_FIBRE) ? ", fiber mode" : ""); + + if (priv->fix_mac_speed) + priv->fix_mac_speed(priv); } static void _dw_eth_halt(struct dw_eth_dev *priv) @@ -322,7 +326,7 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr) return ret; } - dw_adjust_link(mac_p, priv->phydev); + dw_adjust_link(priv, mac_p, priv->phydev); if (!priv->phydev->link) return -EIO; diff --git a/drivers/net/designware.h b/drivers/net/designware.h index 6b4bfd7..792af7c 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -237,6 +237,10 @@ struct dw_eth_dev { struct gpio_desc reset_gpio; struct phy_device *phydev; struct mii_dev *bus; + +#ifdef CONFIG_DM_ETH + int (*fix_mac_speed)(struct dw_eth_dev *priv); +#endif }; #ifdef CONFIG_DM_ETH -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 11/12] rockchip: Add PXE and DHCP to the default boot targets
Now that at least on the firefly board we have network support, enable PXE and DHCP boot targets by default. Signed-off-by: Sjoerd Simons Acked-by: Simon Glass --- Changes in v2: None include/configs/rk3288_common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index 427ac4b..dba1a22 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -108,7 +108,9 @@ /* First try to boot from SD (index 0), then eMMC (index 1 */ #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ - func(MMC, mmc, 1) + func(MMC, mmc, 1) \ + func(PXE, pxe, na) \ + func(DHCP, dchp, na) #include -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 10/12] rockchip: Enable networking support on rock2 and firefly
Enable the various configuration option required to get the ethernet interface up and running on Radxa Rock2 and Firefly. Signed-off-by: Sjoerd Simons --- Changes in v2: None configs/firefly-rk3288_defconfig | 5 + configs/rock2_defconfig | 5 + 2 files changed, 10 insertions(+) diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig index 5aa4166..2ae9ca1 100644 --- a/configs/firefly-rk3288_defconfig +++ b/configs/firefly-rk3288_defconfig @@ -27,6 +27,11 @@ CONFIG_LED_GPIO=y CONFIG_RESET=y CONFIG_DM_MMC=y CONFIG_ROCKCHIP_DWMMC=y +CONFIG_DM_ETH=y +CONFIG_NETDEVICES=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_RK3288=y +CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y # CONFIG_SPL_PINCTRL_FULL is not set diff --git a/configs/rock2_defconfig b/configs/rock2_defconfig index f33daf1..563305b 100644 --- a/configs/rock2_defconfig +++ b/configs/rock2_defconfig @@ -25,6 +25,11 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_RESET=y CONFIG_DM_MMC=y CONFIG_ROCKCHIP_DWMMC=y +CONFIG_DM_ETH=y +CONFIG_NETDEVICES=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_RK3288=y +CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y # CONFIG_SPL_PINCTRL_FULL is not set -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 02/12] net: designware: Export various functions/struct to allow subclassing
To allow other DM drivers to subclass the designware driver various functions and structures need to be exported. Export these. Signed-off-by: Sjoerd Simons Reviewed-by: Bin Meng Acked-by: Simon Glass --- Changes in v2: None drivers/net/designware.c | 6 +++--- drivers/net/designware.h | 4 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 14dd7b8..8834506 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -625,7 +625,7 @@ static int designware_eth_bind(struct udevice *dev) return 0; } -static int designware_eth_probe(struct udevice *dev) +int designware_eth_probe(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); struct dw_eth_dev *priv = dev_get_priv(dev); @@ -673,7 +673,7 @@ static int designware_eth_remove(struct udevice *dev) return 0; } -static const struct eth_ops designware_eth_ops = { +const struct eth_ops designware_eth_ops = { .start = designware_eth_start, .send = designware_eth_send, .recv = designware_eth_recv, @@ -682,7 +682,7 @@ static const struct eth_ops designware_eth_ops = { .write_hwaddr = designware_eth_write_hwaddr, }; -static int designware_eth_ofdata_to_platdata(struct udevice *dev) +int designware_eth_ofdata_to_platdata(struct udevice *dev) { struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); struct dw_eth_dev *priv = dev_get_priv(dev); diff --git a/drivers/net/designware.h b/drivers/net/designware.h index 04a45e0..6b4bfd7 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -240,6 +240,10 @@ struct dw_eth_dev { }; #ifdef CONFIG_DM_ETH +int designware_eth_ofdata_to_platdata(struct udevice *dev); +int designware_eth_probe(struct udevice *dev); +extern const struct eth_ops designware_eth_ops; + struct dw_eth_pdata { struct eth_pdata eth_pdata; u32 reset_delays[3]; -- 2.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 01/12] net: designware: support phy reset device-tree bindings
Add support for the snps,reset-gpio, snps,reset-active-low (optional) and snps,reset-delays-us device-tree bindings. The combination of these three define how the PHY should be reset to ensure it's in a sane state. Signed-off-by: Sjoerd Simons --- Changes in v2: - Store probe gpio in private data not platdata - Drop unneeded header file drivers/net/designware.c | 76 drivers/net/designware.h | 10 +++ 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index ca58f34..14dd7b8 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -24,7 +24,12 @@ DECLARE_GLOBAL_DATA_PTR; static int dw_mdio_read(struct mii_dev *bus, int addr, int devad, int reg) { +#ifdef CONFIG_DM_ETH + struct dw_eth_dev *priv = dev_get_priv((struct udevice *)bus->priv); + struct eth_mac_regs *mac_p = priv->mac_regs_p; +#else struct eth_mac_regs *mac_p = bus->priv; +#endif ulong start; u16 miiaddr; int timeout = CONFIG_MDIO_TIMEOUT; @@ -47,7 +52,12 @@ static int dw_mdio_read(struct mii_dev *bus, int addr, int devad, int reg) static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, u16 val) { +#ifdef CONFIG_DM_ETH + struct dw_eth_dev *priv = dev_get_priv((struct udevice *)bus->priv); + struct eth_mac_regs *mac_p = priv->mac_regs_p; +#else struct eth_mac_regs *mac_p = bus->priv; +#endif ulong start; u16 miiaddr; int ret = -ETIMEDOUT, timeout = CONFIG_MDIO_TIMEOUT; @@ -70,7 +80,41 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, return ret; } -static int dw_mdio_init(const char *name, struct eth_mac_regs *mac_regs_p) +#if CONFIG_DM_ETH +static int dw_mdio_reset(struct mii_dev *bus) +{ + struct udevice *dev = bus->priv; + struct dw_eth_dev *priv = dev_get_priv(dev); + struct dw_eth_pdata *pdata = dev_get_platdata(dev); + int ret; + + if (!dm_gpio_is_valid(&priv->reset_gpio)) + return 0; + + /* reset the phy */ + ret = dm_gpio_set_value(&priv->reset_gpio, 0); + if (ret) + return ret; + + udelay(pdata->reset_delays[0]); + + ret = dm_gpio_set_value(&priv->reset_gpio, 1); + if (ret) + return ret; + + udelay(pdata->reset_delays[1]); + + ret = dm_gpio_set_value(&priv->reset_gpio, 0); + if (ret) + return ret; + + udelay(pdata->reset_delays[2]); + + return 0; +} +#endif + +static int dw_mdio_init(const char *name, void *priv) { struct mii_dev *bus = mdio_alloc(); @@ -82,8 +126,11 @@ static int dw_mdio_init(const char *name, struct eth_mac_regs *mac_regs_p) bus->read = dw_mdio_read; bus->write = dw_mdio_write; snprintf(bus->name, sizeof(bus->name), "%s", name); +#ifdef CONFIG_DM_ETH + bus->reset = dw_mdio_reset; +#endif - bus->priv = (void *)mac_regs_p; + bus->priv = priv; return mdio_register(bus); } @@ -606,7 +653,7 @@ static int designware_eth_probe(struct udevice *dev) priv->interface = pdata->phy_interface; priv->max_speed = pdata->max_speed; - dw_mdio_init(dev->name, priv->mac_regs_p); + dw_mdio_init(dev->name, dev); priv->bus = miiphy_get_dev_by_name(dev->name); ret = dw_phy_init(priv, dev); @@ -637,9 +684,13 @@ static const struct eth_ops designware_eth_ops = { static int designware_eth_ofdata_to_platdata(struct udevice *dev) { - struct eth_pdata *pdata = dev_get_platdata(dev); + struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); + struct dw_eth_dev *priv = dev_get_priv(dev); + struct eth_pdata *pdata = &dw_pdata->eth_pdata; const char *phy_mode; const fdt32_t *cell; + int reset_flags = GPIOD_IS_OUT; + int ret = 0; pdata->iobase = dev_get_addr(dev); pdata->phy_interface = -1; @@ -656,7 +707,20 @@ static int designware_eth_ofdata_to_platdata(struct udevice *dev) if (cell) pdata->max_speed = fdt32_to_cpu(*cell); - return 0; + if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset, + "snps,reset-active-low")) + reset_flags |= GPIOD_ACTIVE_LOW; + + ret = gpio_request_by_name(dev, "snps,reset-gpio", 0, + &priv->reset_gpio, reset_flags); + if (ret == 0) { + ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, + "snps,reset-delays-us", dw_pdata->reset_delays, 3); + } else if (ret == -ENOENT) { + ret = 0; + } + + return ret; } static const struct udevice_id designware_eth_ids[] = { @@ -675,7 +739,7 @@ U_BOOT_DRIVER(eth_designware) = { .remove = designware_eth_remove, .ops= &designware_eth_ops, .priv_aut
Re: [U-Boot] [PATCH 03/17] drivers: usb: musb: add ti musb misc driver for wrapper
On Monday 29 February 2016 09:14 AM, Mugunthan V N wrote: > Add a misc driver for MUSB wrapper, so that based on dr_mode the > USB devices can bind to USB host or USB device drivers. > > Signed-off-by: Mugunthan V N > --- > drivers/usb/musb-new/Kconfig | 9 + > drivers/usb/musb-new/Makefile | 1 + > drivers/usb/musb-new/ti-musb.c | 89 > ++ > 3 files changed, 99 insertions(+) > create mode 100644 drivers/usb/musb-new/ti-musb.c > > diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig > index 6a6cb93..2bcc646 100644 > --- a/drivers/usb/musb-new/Kconfig > +++ b/drivers/usb/musb-new/Kconfig > @@ -13,6 +13,15 @@ config USB_MUSB_GADGET > help > Enables the MUSB USB dual-role controller in gadget mode. > > +config USB_MUSB_TI > + bool "Enable TI OTG USB controller" > + depends on DM_USB > + default y > + help > + Say y here to enable support for the TI OTG USB controller > + used on TI SoCs. fadsf fa fad af adf adf asf adfa fad fd af > +asdf asdf fadsf asf s Oops!, This was done to fix checkpatch warning temporarily but forgot to fix it properly before submitting. Will fix in v2. Regards Mugunthan V N > + > if USB_MUSB_HOST || USB_MUSB_GADGET > > config USB_MUSB_SUNXI > diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile > index 072d516..d137044 100644 > --- a/drivers/usb/musb-new/Makefile > +++ b/drivers/usb/musb-new/Makefile > @@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o > obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o > obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o > obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o > +obj-$(CONFIG_USB_MUSB_TI) += ti-musb.o > > ccflags-y := $(call cc-option,-Wno-unused-variable) \ > $(call cc-option,-Wno-unused-but-set-variable) \ > diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c > new file mode 100644 > index 000..c1a4952 > --- /dev/null > +++ b/drivers/usb/musb-new/ti-musb.c > @@ -0,0 +1,89 @@ > +/* > + * MISC driver for TI MUSB Glue. > + * > + * (C) Copyright 2012-2016 > + * Texas Instruments Incorporated, > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +#ifdef CONFIG_DM_USB > + > +static const char *const usb_dr_modes[] = { > + [USB_DR_MODE_UNKNOWN] = "", > + [USB_DR_MODE_HOST] = "host", > + [USB_DR_MODE_PERIPHERAL]= "peripheral", > + [USB_DR_MODE_OTG] = "otg", > +}; > + > +enum usb_dr_mode usb_get_dr_mode(const char *dr_mode) > +{ > + int i; > + > + for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) > + if (!strcmp(dr_mode, usb_dr_modes[i])) > + return i; > + > + return USB_DR_MODE_UNKNOWN; > +} > + > +static int ti_musb_wrapper_bind(struct udevice *parent) > +{ > + const void *fdt = gd->fdt_blob; > + int node; > + int ret; > + > + for (node = fdt_first_subnode(fdt, parent->of_offset); node > 0; > + node = fdt_next_subnode(fdt, node)) { > + struct udevice *dev; > + const char *name = fdt_get_name(fdt, node, NULL); > + const char *dr_mode_str; > + enum usb_dr_mode dr_mode; > + struct driver *drv; > + > + if (strncmp(name, "usb@", 4)) > + continue; > + > + dr_mode_str = fdt_getprop(fdt, node, "dr_mode", NULL); > + if (!dr_mode_str) { > + error("usb dr_mode not found\n"); > + return -ENOENT; > + } > + > + dr_mode = usb_get_dr_mode(dr_mode_str); > + switch (dr_mode) { > + case USB_DR_MODE_PERIPHERAL: > + /* Bind MUSB device */ > + break; > + case USB_DR_MODE_HOST: > + /* Bind MUSB host */ > + break; > + default: > + break; > + }; > + } > + return 0; > +} > + > +static const struct udevice_id ti_musb_ids[] = { > + { .compatible = "ti,am33xx-usb" }, > + { } > +}; > + > +U_BOOT_DRIVER(ti_musb_wrapper) = { > + .name = "ti-musb-wrapper", > + .id = UCLASS_MISC, > + .of_match = ti_musb_ids, > + .bind = ti_musb_wrapper_bind, > +}; > + > +#endif /* CONFIG_DM_USB */ > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] pull request: u-boot-uniphier/master
Hi Tom, I found a small bug in this series. If it is not too late, please let me fix it and do a 2nd round. If it is, it's OK, I will send a follow-up patch. 2016-02-29 4:03 GMT+09:00 Masahiro Yamada : > Hi Tom, > > Here is a bunch of UniPhier updates which include GPIO driver support, > MMC driver support, DRAM init code clean-ups, etc. Please pull. > > > The following changes since commit 50dc8677d769be6e2b34f49b6c43ad1e977bdc51: > > Merge git://git.denx.de/u-boot-usb (2016-02-26 18:08:43 -0500) > > are available in the git repository at: > > > git://git.denx.de/u-boot-uniphier.git master > > for you to fetch changes up to 6a9220cfe2356aace1b92ec74a1852d7d2659a03: > > ARM: uniphier: fix warnings reported by aarch64 compiler (2016-02-29 > 03:50:16 +0900) > > > Masahiro Yamada (38): > ARM: dts: uniphier: rework System Bus nodes > gpio: uniphier: add driver for UniPhier GPIO controller > gpio: do not include for UniPhier > ARM: uniphier: enable GPIO command and driver for UniPhier SoCs > ARM: dts: uniphier: add GPIO controller nodes > mmc: uniphier: add driver for UniPhier SD/MMC host controller > ARM: uniphier: enable UniPhier SD/MMC host driver > ARM: dts: uniphier: add SD/MMC host controller nodes > ARM: uniphier: add eMMC boot support > ARM: uniphier: add a command to find the first MMC (non-SD) device > ARM: uniphier: add emmcupdate command > ARM: uniphier: default to environment in eMMC > ARM: uniphier: remove unused umc_polling() > ARM: uniphier: rework struct uniphier_board_data > ARM: uniphier: optimize ProXstream2 UMC init code with "for" loop > ARM: uniphier: use pr_err() where possible > ARM: uniphier: refactor UMC init code for ProXstream2 > ARM: uniphier: remove UMC_INITCTL* and UMC_DRMR* settings > ARM: uniphier: disable debug circuit clocks for PH1-Pro4 > ARM: uniphier: add a field to specify DDR3+ > ARM: uniphier: merge DDR PHY init code for 3 SoCs > ARM: uniphier: remove unused argument of ph1_ld4_ddrphy_init() > ARM: uniphier: refactor DDR-PHY init code > ARM: uniphier: refactor UMC init code for PH1-sLD8 > ARM: uniphier: support more DRAM use cases for PH1-sLD8 > ARM: uniphier: refactor UMC init code for PH1-LD4 > ARM: uniphier: optimize PH1-sLD8 UMC init code with "for" loop > ARM: uniphier: optimize PH1-LD4 UMC init code with "for" loop > ARM: uniphier: optimize PH1-Pro4 UMC init code with "for" loop > ARM: uniphier: rework DRAM size handling in UMC init code > ARM: uniphier: remove unused macros for UMC base addresses > ARM: uniphier: deprecate umc_dram_init_{start, poll} > ARM: uniphier: rename variable for DRAM controller base address > ARM: uniphier: merge two defconfig files > ARM: uniphier: rework UniPhier SoC select in Kconfig > ARM: uniphier: rename PH1-LD10/PH1-sLD11 to PH1-LD20/PH1-LD11 > ARM: uniphier: prepare directory structure for ARMv8 SoC support > ARM: uniphier: fix warnings reported by aarch64 compiler > > arch/arm/Kconfig| 3 +- > arch/arm/dts/uniphier-common32.dtsi | 19 +- > arch/arm/dts/uniphier-ph1-ld4-ref.dts | 4 + > arch/arm/dts/uniphier-ph1-ld4.dtsi | 137 +++ > arch/arm/dts/uniphier-ph1-ld6b-ref.dts | 4 + > arch/arm/dts/uniphier-ph1-pro4-ace.dts | 4 + > arch/arm/dts/uniphier-ph1-pro4-ref.dts | 8 + > arch/arm/dts/uniphier-ph1-pro4-sanji.dts| 16 + > arch/arm/dts/uniphier-ph1-pro4.dtsi | 240 > arch/arm/dts/uniphier-ph1-pro5-4kbox.dts| 8 + > arch/arm/dts/uniphier-ph1-pro5.dtsi | 227 +++ > arch/arm/dts/uniphier-ph1-sld3-ref.dts | 4 + > arch/arm/dts/uniphier-ph1-sld3.dtsi | 151 +++- > arch/arm/dts/uniphier-ph1-sld8-ref.dts | 4 + > arch/arm/dts/uniphier-ph1-sld8.dtsi | 137 +++ > arch/arm/dts/uniphier-pinctrl.dtsi | 15 + > arch/arm/dts/uniphier-proxstream2-gentil.dts| 16 + > arch/arm/dts/uniphier-proxstream2-vodka.dts | 16 + > arch/arm/dts/uniphier-proxstream2.dtsi | 220 +++ > arch/arm/include/asm/gpio.h | 2 + > arch/arm/mach-uniphier/Kconfig | 66 ++-- > arch/arm/mach-uniphier/Makefile | 9 +- > arch/arm/mach-uniphier/arm32/Makefile | 13 + > arch/arm/mach-uniphier/{ => arm32}/arm-mpcore.h | 0 > arch/arm/mach-uniphier/{ => arm32}/cache_uniphier.c | 0 > arch/arm/mach-uniphier/{ => arm32}/debug_ll.S | 0 >
[U-Boot] [PATCH 1/1] am33xx: Update serial platdata to update reg_offset to 0
With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver, TI AM335x evms are broken as the serial platdata updates wrong offsets. Correcting it with initializing reg_offset to zero. Signed-off-by: Mugunthan V N --- Verified the patch on AM335x BBB ad AM335x EVMsk. --- arch/arm/cpu/armv7/am33xx/board.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index e8d5be3..2963b3b 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -40,14 +40,14 @@ DECLARE_GLOBAL_DATA_PTR; #if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct ns16550_platdata am33xx_serial[] = { - { CONFIG_SYS_NS16550_COM1, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM1, 0, 2, CONFIG_SYS_NS16550_CLK }, # ifdef CONFIG_SYS_NS16550_COM2 - { CONFIG_SYS_NS16550_COM2, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM2, 0, 2, CONFIG_SYS_NS16550_CLK }, # ifdef CONFIG_SYS_NS16550_COM3 - { CONFIG_SYS_NS16550_COM3, 2, CONFIG_SYS_NS16550_CLK }, - { CONFIG_SYS_NS16550_COM4, 2, CONFIG_SYS_NS16550_CLK }, - { CONFIG_SYS_NS16550_COM5, 2, CONFIG_SYS_NS16550_CLK }, - { CONFIG_SYS_NS16550_COM6, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM3, 0, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM4, 0, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM5, 0, 2, CONFIG_SYS_NS16550_CLK }, + { CONFIG_SYS_NS16550_COM6, 0, 2, CONFIG_SYS_NS16550_CLK }, # endif # endif }; -- 2.7.2.333.g70bd996 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] am33xx: Update serial platdata to update reg_offset to 0
On Monday 29 February 2016 02:55 PM, Mugunthan V N wrote: > With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" > reg_offset is added to the struct ns16550_platdata to be > dt compatible with Linux kernel driver, TI AM335x evms are broken > as the serial platdata updates wrong offsets. Correcting it with > initializing reg_offset to zero. Acked-by: Lokesh Vutla This will be true for OMAP5+ platforms as well. I guess that array also needs to be updated? Thanks and regards, Lokesh > > Signed-off-by: Mugunthan V N > --- > > Verified the patch on AM335x BBB ad AM335x EVMsk. > > --- > arch/arm/cpu/armv7/am33xx/board.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/cpu/armv7/am33xx/board.c > b/arch/arm/cpu/armv7/am33xx/board.c > index e8d5be3..2963b3b 100644 > --- a/arch/arm/cpu/armv7/am33xx/board.c > +++ b/arch/arm/cpu/armv7/am33xx/board.c > @@ -40,14 +40,14 @@ DECLARE_GLOBAL_DATA_PTR; > > #if !CONFIG_IS_ENABLED(OF_CONTROL) > static const struct ns16550_platdata am33xx_serial[] = { > - { CONFIG_SYS_NS16550_COM1, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM1, 0, 2, CONFIG_SYS_NS16550_CLK }, > # ifdef CONFIG_SYS_NS16550_COM2 > - { CONFIG_SYS_NS16550_COM2, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM2, 0, 2, CONFIG_SYS_NS16550_CLK }, > # ifdef CONFIG_SYS_NS16550_COM3 > - { CONFIG_SYS_NS16550_COM3, 2, CONFIG_SYS_NS16550_CLK }, > - { CONFIG_SYS_NS16550_COM4, 2, CONFIG_SYS_NS16550_CLK }, > - { CONFIG_SYS_NS16550_COM5, 2, CONFIG_SYS_NS16550_CLK }, > - { CONFIG_SYS_NS16550_COM6, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM3, 0, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM4, 0, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM5, 0, 2, CONFIG_SYS_NS16550_CLK }, > + { CONFIG_SYS_NS16550_COM6, 0, 2, CONFIG_SYS_NS16550_CLK }, > # endif > # endif > }; > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: gadget: composite: Correct recovery path for register
Hi Marek, > On 02/26/2016 08:43 PM, Sam Protsenko wrote: > > On Fri, Feb 19, 2016 at 9:34 PM, Sam Protsenko > > wrote: > >> + Praneeth Bajjuri > >> + Tom Rini > >> + Rob Herring > >> > >> On Tue, Feb 16, 2016 at 7:59 PM, Semen Protsenko > >> wrote: > >>> From: Sam Protsenko > >>> > >>> In case when usb_composite_register() failed once (for whatever > >>> reason), it will fail further even if all conditions are correct. > >>> Example: > >>> > >>> => fastboot 2 > >>> Invalid Controller Index > >>> couldn't find an available UDC > >>> g_dnl_register: failed!, error: -19 > >>> exit not allowed from main input shell. > >>> > >>> => fastboot 0 > >>> g_dnl_register: failed!, error: -22 > >>> exit not allowed from main input shell. > >>> > >>> Despite that 0 is correct index for USB controller, "fastboot 0" > >>> command will fail, because "composite" structure wasn't cleared > >>> properly on previous fail (on "fastboot 2" command). > >>> > >>> This patch fixes that erroneous behavior, allowing us to use > >>> composite even after previous failure. > >>> > >>> Signed-off-by: Sam Protsenko > >>> --- > >>> drivers/usb/gadget/composite.c | 8 +++- > >>> 1 file changed, 7 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/usb/gadget/composite.c > >>> b/drivers/usb/gadget/composite.c index 60f9272..d0ee784 100644 > >>> --- a/drivers/usb/gadget/composite.c > >>> +++ b/drivers/usb/gadget/composite.c > >>> @@ -1077,6 +1077,8 @@ static struct usb_gadget_driver > >>> composite_driver = { */ > >>> int usb_composite_register(struct usb_composite_driver *driver) > >>> { > >>> + int res; > >>> + > >>> if (!driver || !driver->dev || !driver->bind || composite) > >>> return -EINVAL; > >>> > >>> @@ -1084,7 +1086,11 @@ int usb_composite_register(struct > >>> usb_composite_driver *driver) driver->name = "composite"; > >>> composite = driver; > >>> > >>> - return usb_gadget_register_driver(&composite_driver); > >>> + res = usb_gadget_register_driver(&composite_driver); > >>> + if (res != 0) > >>> + composite = NULL; > >>> + > >>> + return res; > >>> } > >>> > >>> /** > >>> -- > >>> 2.7.0 > >>> > > > > bump > > > > Looks fine. Lukasz, shall I pick this myself ? > > btw if this isn't applied in a week, please ping me and I will pick it > nonetheless. > I will add this to my tree. And test it afterwards. I will send new PR with some other patches. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] U-Boot as first bootloader on Exynos platforms
Hi Paul, > Hi, > > I was told some time ago that a publicly-available version of the > Samsung Chromebook 2 (supposedly, the one with an Exynos 5800 SoC) > allows running unsigned code (the U-Boot SPL) directly after the > bootrom. Is that correct? > > Do you know of any (other) publicly available device with an Exynos > SoC that doesn't check for the first bootloader's signature, and thus > could load the U- Boot SPL without any intermediary signed stage on > storage memory? For sure Odroid XU3 needs signed SPL to boot up, so this devel board will not work for you. > > Cheers, -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] Add support the Avionic Design Meerkat COM and Kein Baseboard
Hi Stephen, On 23.02.2016 19:03, Stephen Warren wrote: On 02/23/2016 05:59 AM, Julian Scheel wrote: Add support for platforms based on the Meerkat COM module. Includes support for the minimal reference platform called Kein Baseboard, which in fact is sufficient to run most existing Meerkat carriers. diff --git a/arch/arm/dts/tegra124-meerkat.dtsi b/arch/arm/dts/tegra124-meerkat.dtsi +aliases { +i2c0 = "/i2c@7000c000"; +i2c1 = "/i2c@7000c400"; +i2c2 = "/i2c@7000c500"; +i2c3 = "/i2c@7000c700"; +i2c4 = "/i2c@7000d000"; +i2c5 = "/i2c@7000d100"; /i2c@7000d000 is alias i2c0 on all other Tegra boards that have I2C aliases. we just had a quick discussion about this and actually we explicitly changed it in our tree to a linear mapping of the controller addresses to be in sync with what we have in the l4t kernel. If it won't hurt you too much we'd like to keep it that way. Though if you feel really bad about it, we can change it to use the same mapping as Jetson uses. -Julian ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] spl_mmc: allow to load raw image
The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, the bad magic checking here makes the spl_parse_image_header() unreachable in case of the missing header. Signed-off-by: Masahiro Yamada --- common/spl/spl_mmc.c | 5 - 1 file changed, 5 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index c27a250..df406e3 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -33,11 +33,6 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector) if (count == 0) goto end; - if (image_get_magic(header) != IH_MAGIC) { - puts("bad magic\n"); - return -1; - } - spl_parse_image_header(header); /* convert size to sectors - round up */ -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] OMAP3: Various: Update serial platdata to update reg_offset to 0
With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver. A variety of OMAP3 boards are broken as the serial platdata is missing offsets. By explicitly naming the entry, this should also help 'future-proof' if more entries get added but are not needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. I only changed a handful of devices that used the same syntax as the Logic board. Appologies if I missed one or stepped on toes. Thanks to Derald Woods and Alexander Graf. Signed-off-by: Adam Ford --- board/isee/igep00x0/igep00x0.c | 7 --- board/logicpd/omap3som/omap3logic.c | 7 --- board/logicpd/zoom1/zoom1.c | 7 --- board/overo/overo.c | 7 --- board/quipos/cairo/cairo.c | 7 --- board/ti/beagle/beagle.c| 7 --- board/timll/devkit8000/devkit8000.c | 7 --- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e2fce50..63489e5 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { #endif static const struct ns16550_platdata igep_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(igep_uart) = { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 668f684..0e72a5a 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; */ static const struct ns16550_platdata omap3logic_serial = { - OMAP34XX_UART1, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(omap3logic_uart) = { diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index 4040114..3d34919 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { }; static const struct ns16550_platdata zoom1_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(zoom1_uart) = { diff --git a/board/overo/overo.c b/board/overo/overo.c index a38b959..37b2172 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -68,9 +68,10 @@ static struct { } expansion_config = {0x0}; static const struct ns16550_platdata overo_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(overo_uart) = { diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c index 21793e8..15d68c1 100644 --- a/board/quipos/cairo/cairo.c +++ b/board/quipos/cairo/cairo.c @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) #endif static const struct ns16550_platdata cairo_serial = { - OMAP34XX_UART2, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(cairo_uart) = { diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ff317ef..e811b8d 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -73,9 +73,10 @@ static struct { } expansion_config; static const struct ns16550_platdata beagle_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(beagle_uart) = { diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 1a447c7..149c5f4 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -46,9 +46,10 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { }; static const struct ns16550_platdata devkit8000_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(devkit8000_uart) = { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] spl_nor: fix warning when compiled for 64bit target
Fix "warning: cast to pointer from integer of different size". Signed-off-by: Masahiro Yamada --- common/spl/spl_nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index e08afe2..d0bd0b0 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -59,7 +59,7 @@ int spl_nor_load_image(void) spl_parse_image_header( (const struct image_header *)CONFIG_SYS_UBOOT_BASE); - memcpy((void *)spl_image.load_addr, + memcpy((void *)(unsigned long)spl_image.load_addr, (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)), spl_image.size); -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
V2: I hastily copy-pasted the boards without looking at the UART number. This addresses 3 boards that use UART3 and not UART1. With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver. A variety of OMAP3 boards are broken as the serial platdata is missing offsets. By explicitly naming the entry, this should also help 'future-proof' if more entries get added but are not needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. I only changed a handful of devices that used the same syntax as the Logic board. Appologies if I missed one or stepped on toes. Thanks to Derald Woods and Alexander Graf. Signed-off-by: Adam Ford --- board/isee/igep00x0/igep00x0.c | 7 --- board/logicpd/omap3som/omap3logic.c | 7 --- board/logicpd/zoom1/zoom1.c | 7 --- board/overo/overo.c | 7 --- board/quipos/cairo/cairo.c | 7 --- board/ti/beagle/beagle.c| 7 --- board/timll/devkit8000/devkit8000.c | 7 --- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e2fce50..63489e5 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { #endif static const struct ns16550_platdata igep_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(igep_uart) = { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 668f684..0e72a5a 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; */ static const struct ns16550_platdata omap3logic_serial = { - OMAP34XX_UART1, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(omap3logic_uart) = { diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index 4040114..3d34919 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { }; static const struct ns16550_platdata zoom1_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(zoom1_uart) = { diff --git a/board/overo/overo.c b/board/overo/overo.c index a38b959..3da80e9 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -68,9 +68,10 @@ static struct { } expansion_config = {0x0}; static const struct ns16550_platdata overo_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(overo_uart) = { diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c index 21793e8..15d68c1 100644 --- a/board/quipos/cairo/cairo.c +++ b/board/quipos/cairo/cairo.c @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) #endif static const struct ns16550_platdata cairo_serial = { - OMAP34XX_UART2, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(cairo_uart) = { diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ff317ef..a5f2af7 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -73,9 +73,10 @@ static struct { } expansion_config; static const struct ns16550_platdata beagle_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(beagle_uart) = { diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 1a447c7..fb8e357 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -46,9 +46,10 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { }; static const struct ns16550_platdata devkit8000_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(devkit8000_uart) = { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] mtd: denali: fix warning when compiled for 64bit system
The 64-bit compiler (ex. aarch64) emits "warning: cast from pointer to integer of different size". Make it work with 64bit DMA address while I am here. Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/denali.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index b94fb29..53e6956 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -747,7 +747,7 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op) { uint32_t mode; const int page_count = 1; - uint32_t addr = (uint32_t)denali->buf.dma_buf; + uint64_t addr = (unsigned long)denali->buf.dma_buf; flush_dcache_range(addr, addr + sizeof(denali->buf.dma_buf)); @@ -765,7 +765,7 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op) index_addr(denali, mode, addr); /* 3. set memory high address bits 64:32 */ - index_addr(denali, mode, 0); + index_addr(denali, mode, addr >> 32); #else mode = MODE_10 | BANK(denali->flash_bank); @@ -775,7 +775,7 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op) index_addr(denali, mode | denali->page, 0x2000 | op | page_count); /* 2. set memory high address bits 23:8 */ - index_addr(denali, mode | ((addr >> 16) << 8), 0x2200); + index_addr(denali, mode | (((addr >> 16) & 0x) << 8), 0x2200); /* 3. set memory low address bits 23:8 */ index_addr(denali, mode | ((addr & 0x) << 8), 0x2300); -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: gadget: composite: Correct recovery path for register
On 02/29/2016 11:11 AM, Lukasz Majewski wrote: > Hi Marek, > >> On 02/26/2016 08:43 PM, Sam Protsenko wrote: >>> On Fri, Feb 19, 2016 at 9:34 PM, Sam Protsenko >>> wrote: + Praneeth Bajjuri + Tom Rini + Rob Herring On Tue, Feb 16, 2016 at 7:59 PM, Semen Protsenko wrote: > From: Sam Protsenko > > In case when usb_composite_register() failed once (for whatever > reason), it will fail further even if all conditions are correct. > Example: > > => fastboot 2 > Invalid Controller Index > couldn't find an available UDC > g_dnl_register: failed!, error: -19 > exit not allowed from main input shell. > > => fastboot 0 > g_dnl_register: failed!, error: -22 > exit not allowed from main input shell. > > Despite that 0 is correct index for USB controller, "fastboot 0" > command will fail, because "composite" structure wasn't cleared > properly on previous fail (on "fastboot 2" command). > > This patch fixes that erroneous behavior, allowing us to use > composite even after previous failure. > > Signed-off-by: Sam Protsenko > --- > drivers/usb/gadget/composite.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/composite.c > b/drivers/usb/gadget/composite.c index 60f9272..d0ee784 100644 > --- a/drivers/usb/gadget/composite.c > +++ b/drivers/usb/gadget/composite.c > @@ -1077,6 +1077,8 @@ static struct usb_gadget_driver > composite_driver = { */ > int usb_composite_register(struct usb_composite_driver *driver) > { > + int res; > + > if (!driver || !driver->dev || !driver->bind || composite) > return -EINVAL; > > @@ -1084,7 +1086,11 @@ int usb_composite_register(struct > usb_composite_driver *driver) driver->name = "composite"; > composite = driver; > > - return usb_gadget_register_driver(&composite_driver); > + res = usb_gadget_register_driver(&composite_driver); > + if (res != 0) > + composite = NULL; > + > + return res; > } > > /** > -- > 2.7.0 > >>> >>> bump >>> >> >> Looks fine. Lukasz, shall I pick this myself ? >> >> btw if this isn't applied in a week, please ping me and I will pick it >> nonetheless. >> > > I will add this to my tree. And test it afterwards. > > I will send new PR with some other patches. > Roger, thanks! -- 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 03/17] drivers: usb: musb: add ti musb misc driver for wrapper
On 02/29/2016 04:44 AM, Mugunthan V N wrote: > Add a misc driver for MUSB wrapper, so that based on dr_mode the > USB devices can bind to USB host or USB device drivers. > > Signed-off-by: Mugunthan V N > --- > drivers/usb/musb-new/Kconfig | 9 + > drivers/usb/musb-new/Makefile | 1 + > drivers/usb/musb-new/ti-musb.c | 89 > ++ > 3 files changed, 99 insertions(+) > create mode 100644 drivers/usb/musb-new/ti-musb.c > > diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig > index 6a6cb93..2bcc646 100644 > --- a/drivers/usb/musb-new/Kconfig > +++ b/drivers/usb/musb-new/Kconfig > @@ -13,6 +13,15 @@ config USB_MUSB_GADGET > help > Enables the MUSB USB dual-role controller in gadget mode. > > +config USB_MUSB_TI > + bool "Enable TI OTG USB controller" > + depends on DM_USB > + default y > + help > + Say y here to enable support for the TI OTG USB controller > + used on TI SoCs. fadsf fa fad af adf adf asf adfa fad fd af > +asdf asdf fadsf asf s > + > if USB_MUSB_HOST || USB_MUSB_GADGET > > config USB_MUSB_SUNXI > diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile > index 072d516..d137044 100644 > --- a/drivers/usb/musb-new/Makefile > +++ b/drivers/usb/musb-new/Makefile > @@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o > obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o > obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o > obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o > +obj-$(CONFIG_USB_MUSB_TI) += ti-musb.o > > ccflags-y := $(call cc-option,-Wno-unused-variable) \ > $(call cc-option,-Wno-unused-but-set-variable) \ > diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c > new file mode 100644 > index 000..c1a4952 > --- /dev/null > +++ b/drivers/usb/musb-new/ti-musb.c > @@ -0,0 +1,89 @@ > +/* > + * MISC driver for TI MUSB Glue. > + * > + * (C) Copyright 2012-2016 > + * Texas Instruments Incorporated, > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +#ifdef CONFIG_DM_USB > + > +static const char *const usb_dr_modes[] = { > + [USB_DR_MODE_UNKNOWN] = "", This should probably be "unknown" and not empty string. > + [USB_DR_MODE_HOST] = "host", > + [USB_DR_MODE_PERIPHERAL]= "peripheral", > + [USB_DR_MODE_OTG] = "otg", > +}; [...] -- 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 05/17] drivers: usb: musb: adopt musb backend driver to driver model
On 02/29/2016 04:44 AM, Mugunthan V N wrote: > Currently all backend driver ops uses hard coded physical > address, so to adopt the driver to DM, add device pointer to ops > call backs so that drivers that drivers can get physical > addresses from the usb driver priv/plat data. > > Signed-off-by: Mugunthan V N > --- [...] > @@ -704,8 +719,13 @@ static int dsps_resume(struct device *dev) > struct omap_musb_board_data *data = plat->board_data; > > /* Start the on-chip PHY and its PLL. */ > +#ifndef CONFIG_DM_USB > if (data->set_phy_power) > data->set_phy_power(1); > +#else > + if (data->set_phy_power) > + data->set_phy_power(data->dev, 1); Would it be possible to avoid adding this sea of ifdefs into the driver? > +#endif > > return 0; > } > -- 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 v6 00/76] mtd: Add SPI-NOR core support
Hi York, On 27 February 2016 at 02:14, york sun wrote: > On 02/22/2016 10:18 AM, Jagan Teki wrote: >> Hi York, >> >> On 15 February 2016 at 02:16, Jagan Teki wrote: >>> Compared to previous patch series this series adds spi-nor >>> core with spi-nor controller drivers are of "mtd uclass" >>> >>> This is whole series for all spi-nor related changes, and while >>> series tested on spansion spi-nor chip. >>> >>> Know issue: >>> - arch/x86/lib/mrccache.c uses dm_spi_flash_ops, this need to fix. >>> >>> Why this framework: >>> >>> Some of the SPI device drivers at drivers/spi not a real >>> spi controllers, Unlike normal/generic SPI controllers they >>> operates only with SPI-NOR flash devices. these were technically >>> termed as SPI-NOR controllers, Ex: drivers/spi/fsl_qspi.c >>> >>> The problem with these were resides at drivers/spi is entire >>> SPI layer becomes SPI-NOR flash oriented which is absolutely >>> a wrong indication where SPI layer getting effected more with >>> flash operations - So this SPI-NOR core will resolve this issue >>> by separating all SPI-NOR flash operations from spi layer and >>> creats a generic layer called SPI-NOR core which can be used to >>> interact SPI-NOR to SPI driver interface layer and the SPI-NOR >>> controller driver. The idea is taken from Linux spi-nor framework. >>> >>> Before SPI-NOR: >>> >>> --- >>> cmd/sf.c >>> --- >>> spi_flash.c >>> --- >>> sf_probe.c >>> --- >>> spi-uclass >>> --- >>> spi drivers >>> --- >>> SPI NOR chip >>> --- >>> >>> After SPI-NOR: >>> >>> -- >>> cmd/sf.c >>> -- >>> spi-nor.c >>> --- >>> m25p80.cspi nor drivers >>> --- >>> spi-uclass SPI NOR chip >>> --- >>> spi drivers >>> --- >>> SPI NOR chip >>> --- >>> >>> SPI-NOR with MTD: >>> >>> -- >>> cmd/sf.c >>> -- >>> MTD core >>> -- >>> spi-nor.c >>> --- >>> m25p80.cspi nor drivers >>> --- >>> spi-uclass SPI NOR chip >>> --- >>> spi drivers >>> --- >>> SPI NOR chip >>> --- >>> >>> drivers/mtd/spi-nor/spi-nor.c: spi-nor core >>> drivers/mtd/spi-nor/m25p80.c: mtd uclass driver >>> which is an interface layer b/w spi-nor core drivers/spi >>> drivers/mtd/spi-nor/fsl_qspi.c: spi-nor controller driver(mtd uclass) >>> >>> Changes for v6: >>> - Fixed git bisectable issues, with buildman. >>> - Fixed spi-nor compilation issues >>> - newly designed changes. >>> >>> Changes for v5: >>> - newly designed changes >>> >>> Testing: >>> $ git clone git://git.denx.de/u-boot-spi.git >>> $ cd u-boot-spi >>> $ git checkout -b spi-nor origin/spi-nor >>> >>> Jagan Teki (76): >>> mtd: Add m25p80 driver >>> mtd: Add Kconfig entry for MTD_M25P80 >>> mtd: Add SPI-NOR core support >>> doc: device-tree-bindings: jedec,spi-nor >>> mtd: spi-nor: Add Kconfig entry for MTD_SPI_NOR >>> mtd: spi-nor: Add kconfig for MTD_SPI_NOR_USE_4K_SECTORS >>> mtd: spi-nor: Add MTD support >>> mtd: spi-nor: Add spi_nor support in m25p80 >>> mtd: spi-nor: Add dm spi-nor probing >>> mtd: spi-nor: Add spi_flash_probe for mtd-dm-spi-nor >>> mtd: spi-nor: Add spi_flash_free for mtd-dm-spi-nor >>> mtd: spi-nor: m25p80: Add spi_nor support for non-dm >>> sf: Rename erase_size to erasesize >>> sf: Use erasesize instead of sector_size >>> sf: Use uint64_t for flash->size >>> spi_flash: Use mtd_info operation for SPI-NOR >>> spi_flash: Use spi_flash_t instead of struct spi_flash >>> mtd: spi-nor: Move spi_read_then_write to spi layer >>> spi: Rename spi_read_then_write to spi_write_then_read >>> mtd: spi-nor: Rename SPI_FLASH_BAR to SPI_NOR_BAR >>> mtd: spi-nor: Add Kconfig entry for SPI_NOR_BAR >>> mtd: spi-nor: Copy spl files from drivers/mtd/spi >>> mtd: spi-nor: spl: Follow ascending order of include headers >>> mtd: spi-nor: fsl_espi_spl: Use mtd_info >>> mtd: spi-nor: spi_spl_load: Use mtd_info >>> mtd: spi-nor: Add flash vendor Kconfig entries >>> arm: zynq: Kconfig: Select MTD uclass >>> arm: zynq: Kconfig: Drop DM_SPI_FLASH >>> defconfigs: zynq_microzed: Drop CONFIG_SPI_FLASH >>> defconfig: zynq_microzed: Enable CONFIG_MTD_M25P80 >>> defconfig: zynq_microzed: Enable CONFIG_MTD_SPI_NOR >>> spl: Add CONFIG_SPL_SPI_NOR_SUPPORT >>> configs: zynq: Use CONFIG_SPL_SPI_NOR_SUPPORT >>> configs: zynq: Use CONFIG_SPL_MTD_SUPPORT >>> mtd: spi-nor: Copy sf_dataflash >>> mtd: dataflash: Remove unneeded spi data >>> mtd: d
Re: [U-Boot] [PATCH v6 00/76] mtd: Add SPI-NOR core support
Hi Fabio, On 24 February 2016 at 02:16, Fabio Estevam wrote: > On Tue, Feb 23, 2016 at 10:03 AM, Jagan Teki wrote: >> Hi Fabio, >> >> On 23 February 2016 at 00:22, Fabio Estevam wrote: >>> On Mon, Feb 22, 2016 at 3:17 PM, Jagan Teki wrote: >>> Can you pls- test the dataflash changes? use u-boot-spi/spi-nor >>> >>> Does not even build for me (mx6qsabresd_defconfig) : >> >> Please try again, I think I missed some changes. mean while I ran >> buildman again will update that one as well. > > Now it builds and basic sf commands work fine. Please verify 'sf protect' as well if you haven't tested. thanks! -- Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
Hello Adam, Am 29.02.2016 um 12:53 schrieb Adam Ford: V2: I hastily copy-pasted the boards without looking at the UART number. This addresses 3 boards that use UART3 and not UART1. With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver. A variety of OMAP3 boards are broken as the serial platdata is missing offsets. By explicitly naming the entry, this should also help 'future-proof' if more entries get added but are not needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. I only changed a handful of devices that used the same syntax as the Logic board. Appologies if I missed one or stepped on toes. Thanks to Derald Woods and Alexander Graf. Signed-off-by: Adam Ford --- board/isee/igep00x0/igep00x0.c | 7 --- board/logicpd/omap3som/omap3logic.c | 7 --- board/logicpd/zoom1/zoom1.c | 7 --- board/overo/overo.c | 7 --- board/quipos/cairo/cairo.c | 7 --- board/ti/beagle/beagle.c| 7 --- board/timll/devkit8000/devkit8000.c | 7 --- 7 files changed, 28 insertions(+), 21 deletions(-) What has changed exactly in v2 ? Beside of this: Reviewed-by: Heiko Schocher Thanks! bye, Heiko diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e2fce50..63489e5 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { #endif static const struct ns16550_platdata igep_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(igep_uart) = { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 668f684..0e72a5a 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; */ static const struct ns16550_platdata omap3logic_serial = { - OMAP34XX_UART1, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(omap3logic_uart) = { diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index 4040114..3d34919 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { }; static const struct ns16550_platdata zoom1_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(zoom1_uart) = { diff --git a/board/overo/overo.c b/board/overo/overo.c index a38b959..3da80e9 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -68,9 +68,10 @@ static struct { } expansion_config = {0x0}; static const struct ns16550_platdata overo_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(overo_uart) = { diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c index 21793e8..15d68c1 100644 --- a/board/quipos/cairo/cairo.c +++ b/board/quipos/cairo/cairo.c @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) #endif static const struct ns16550_platdata cairo_serial = { - OMAP34XX_UART2, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(cairo_uart) = { diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ff317ef..a5f2af7 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -73,9 +73,10 @@ static struct { } expansion_config; static const struct ns16550_platdata beagle_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(beagle_uart) = { diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 1a447c7..fb8e357 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -46,9 +46,10 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { }; static const struct ns16550_platdata devkit8000_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(devkit8000_uart) = { -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell
Re: [U-Boot] [PATCH 2/2] warp7: Add initial support
On Mon, Feb 29, 2016 at 2:15 AM, Peng Fan wrote: >>+ MX7D_PAD_SD3_RESET_B__SD3_RESET_B | MUX_PAD_CTRL(USDHC_PAD_CTRL), > > Will this pin be used? I did not see code to use this. It is OK to configure the IOMUX correctly independently of the driver using it or not. >>+CONFIG_IMX_RDC=y >>+CONFIG_IMX_BOOTAUX=y > > default enable RDC and BOOTAUX? That's OK. Same is done in mx7dsabresd. >>+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg,MX7D" > > I just an idea that we move the MX7D to Kconfig entry using "SELECT MX7D", > how do you think? Agreed. Did as you suggested in v2. Thanks ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] warp7: Add initial support
From: Fabio Estevam Add the basic support for Warp7 board. For more information about this reference design, please visit: https://www.element14.com/community/docs/DOC-79058/l/warp-7-the-next-generation-wearable-reference-platform Signed-off-by: Fabio Estevam Reviewed-by: Peng Fan --- Changes since v1: - Select MX7D in the Kconfig (Peng) arch/arm/cpu/armv7/mx7/Kconfig | 7 ++ board/warp7/Kconfig| 9 +++ board/warp7/MAINTAINERS| 6 ++ board/warp7/Makefile | 6 ++ board/warp7/imximage.cfg | 95 ++ board/warp7/warp7.c| 102 configs/warp7_defconfig| 12 include/configs/warp7.h| 149 + 8 files changed, 386 insertions(+) create mode 100644 board/warp7/Kconfig create mode 100644 board/warp7/MAINTAINERS create mode 100644 board/warp7/Makefile create mode 100644 board/warp7/imximage.cfg create mode 100644 board/warp7/warp7.c create mode 100644 configs/warp7_defconfig create mode 100644 include/configs/warp7.h diff --git a/arch/arm/cpu/armv7/mx7/Kconfig b/arch/arm/cpu/armv7/mx7/Kconfig index 97d6238..8e1ddcd 100644 --- a/arch/arm/cpu/armv7/mx7/Kconfig +++ b/arch/arm/cpu/armv7/mx7/Kconfig @@ -18,11 +18,18 @@ config TARGET_MX7DSABRESD select DM select DM_THERMAL +config TARGET_WARP7 + bool "warp7" + select MX7D + select DM + select DM_THERMAL + endchoice config SYS_SOC default "mx7" source "board/freescale/mx7dsabresd/Kconfig" +source "board/warp7/Kconfig" endif diff --git a/board/warp7/Kconfig b/board/warp7/Kconfig new file mode 100644 index 000..61c33fb --- /dev/null +++ b/board/warp7/Kconfig @@ -0,0 +1,9 @@ +if TARGET_WARP7 + +config SYS_BOARD + default "warp7" + +config SYS_CONFIG_NAME + default "warp7" + +endif diff --git a/board/warp7/MAINTAINERS b/board/warp7/MAINTAINERS new file mode 100644 index 000..1d3ee29 --- /dev/null +++ b/board/warp7/MAINTAINERS @@ -0,0 +1,6 @@ +WARP7 BOARD +M: Fabio Estevam +S: Maintained +F: board/warp7/ +F: include/configs/warp7.h +F: configs/warp7_defconfig diff --git a/board/warp7/Makefile b/board/warp7/Makefile new file mode 100644 index 000..f39d1d8 --- /dev/null +++ b/board/warp7/Makefile @@ -0,0 +1,6 @@ +# (C) Copyright 2016 NXP Semiconductors +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := warp7.o diff --git a/board/warp7/imximage.cfg b/board/warp7/imximage.cfg new file mode 100644 index 000..e7b6d30 --- /dev/null +++ b/board/warp7/imximage.cfg @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2016 NXP Semiconductors + * + * SPDX-License-Identifier:GPL-2.0 + * + * Refer docs/README.imxmage for more details about how-to configure + * and create imximage boot image + * + * The syntax is taken as close as possible with the kwbimage + */ + +#define __ASSEMBLY__ +#include + +IMAGE_VERSION 2 +BOOT_FROM sd + +/* + * Device Configuration Data (DCD) + * + * Each entry must have the format: + * Addr-type AddressValue + * + * where: + * Addr-type register length (1,2 or 4 bytes) + * Address absolute address of the register + * value value to be stored in the register + */ + +DATA 4 0x30340004 0x4F45 + +DATA 4 0x30391000 0x0002 +DATA 4 0x307a 0x03040008 +DATA 4 0x307a0064 0x00200038 +DATA 4 0x307a0490 0x0001 +DATA 4 0x307a00d0 0x00350001 +DATA 4 0x307a00dc 0x00c3000a +DATA 4 0x307a00e0 0x0001 +DATA 4 0x307a00e4 0x00110006 +DATA 4 0x307a00f4 0x033f +DATA 4 0x307a0100 0x0a0e110b +DATA 4 0x307a0104 0x00020211 +DATA 4 0x307a0108 0x03060708 +DATA 4 0x307a010c 0x00a0500c +DATA 4 0x307a0110 0x05020307 +DATA 4 0x307a0114 0x02020404 +DATA 4 0x307a0118 0x02020003 +DATA 4 0x307a011c 0x0202 +DATA 4 0x307a0120 0x0202 + +DATA 4 0x307a0180 0x00600018 +DATA 4 0x307a0184 0x00e00100 +DATA 4 0x307a0190 0x02098205 +DATA 4 0x307a0194 0x00060303 +DATA 4 0x307a01a0 0x8043 +DATA 4 0x307a01a4 0x00100020 +DATA 4 0x307a01a8 0x8014 + +DATA 4 0x307a0200 0x0015 +DATA 4 0x307a0204 0x00161616 +DATA 4 0x307a0210 0x0f0f +DATA 4 0x307a0214 0x04040404 +DATA 4 0x307a0218 0x0f0f0404 + +DATA 4 0x307a0240 0x06000600 +DATA 4 0x307a0244 0x +DATA 4 0x30391000 0x +DATA 4 0x3079 0x17421e40 +DATA 4 0x30790004 0x10210100 +DATA 4 0x30790008 0x0001 +DATA 4 0x30790010 0x0007080c +DATA 4 0x307900b0 0x1010007e + +DATA 4 0x3079001C 0x0101 +DATA 4 0x3079009c 0x0d6e + +DATA 4 0x30790030 0x06060606 +DATA 4 0x30790020 0x0a0a0a0a +DATA 4 0x30790050 0x0108 +DATA 4 0x30790050 0x0008 +DATA 4 0x30790018 0x000f +DATA 4 0x307900c0 0x0e487304 +DATA 4 0x307900c0 0x0e4c7304 +DATA 4 0x307900c0 0x0e4c7306 +DATA 4 0x307900c0 0x0e4c7304 + +CHECK_BITS_SET 4 0x307900c4 0x1 + +DATA 4 0x307900c0 0x0e487304 + +DATA 4 0x30384130 0x +DATA 4 0x30340020 0x0178 +DATA 4 0x30384130 0x0002 + +CHECK_BITS_SET 4 0x307a0004 0x1 d
[U-Boot] [PATCH v2 1/2] mx7_common: Put early/late init configs into board file
From: Fabio Estevam CONFIG_BOARD_EARLY_INIT_F and CONFIG_BOARD_LATE_INIT should not be placed into mx7_common because not all boards need these options. Move them to the board file instead. Signed-off-by: Fabio Estevam Reviewed-by: Peng Fan --- Changes since v1: - None include/configs/mx7_common.h | 3 --- include/configs/mx7dsabresd.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h index fac7c3f..a78fc7c 100644 --- a/include/configs/mx7_common.h +++ b/include/configs/mx7_common.h @@ -32,9 +32,6 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M) -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_BOARD_LATE_INIT - #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h index 2c981e0..d233572 100644 --- a/include/configs/mx7dsabresd.h +++ b/include/configs/mx7dsabresd.h @@ -14,6 +14,9 @@ #define CONFIG_DBG_MONITOR #define PHYS_SDRAM_SIZESZ_1G +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_LATE_INIT + /* Uncomment to enable secure boot support */ /* #define CONFIG_SECURE_BOOT */ #define CONFIG_CSF_SIZE0x4000 -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 00/76] mtd: Add SPI-NOR core support
On Mon, Feb 29, 2016 at 9:27 AM, Jagan Teki wrote: > Please verify 'sf protect' as well if you haven't tested. I tested it last week and it worked fine. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v6 00/76] mtd: Add SPI-NOR core support
Hi Simon, On 27 February 2016 at 04:34, Simon Glass wrote: > Hi Jagan, > > On 26 February 2016 at 13:44, york sun wrote: >> On 02/22/2016 10:18 AM, Jagan Teki wrote: >>> Hi York, >>> >>> On 15 February 2016 at 02:16, Jagan Teki wrote: Compared to previous patch series this series adds spi-nor core with spi-nor controller drivers are of "mtd uclass" This is whole series for all spi-nor related changes, and while series tested on spansion spi-nor chip. Know issue: - arch/x86/lib/mrccache.c uses dm_spi_flash_ops, this need to fix. Why this framework: Some of the SPI device drivers at drivers/spi not a real spi controllers, Unlike normal/generic SPI controllers they operates only with SPI-NOR flash devices. these were technically termed as SPI-NOR controllers, Ex: drivers/spi/fsl_qspi.c The problem with these were resides at drivers/spi is entire SPI layer becomes SPI-NOR flash oriented which is absolutely a wrong indication where SPI layer getting effected more with flash operations - So this SPI-NOR core will resolve this issue by separating all SPI-NOR flash operations from spi layer and creats a generic layer called SPI-NOR core which can be used to interact SPI-NOR to SPI driver interface layer and the SPI-NOR controller driver. The idea is taken from Linux spi-nor framework. Before SPI-NOR: --- cmd/sf.c --- spi_flash.c --- sf_probe.c --- spi-uclass --- spi drivers --- SPI NOR chip --- After SPI-NOR: -- cmd/sf.c -- spi-nor.c --- m25p80.cspi nor drivers --- spi-uclass SPI NOR chip --- spi drivers --- SPI NOR chip --- SPI-NOR with MTD: -- cmd/sf.c -- MTD core -- spi-nor.c --- m25p80.cspi nor drivers --- spi-uclass SPI NOR chip --- spi drivers --- SPI NOR chip --- drivers/mtd/spi-nor/spi-nor.c: spi-nor core drivers/mtd/spi-nor/m25p80.c: mtd uclass driver which is an interface layer b/w spi-nor core drivers/spi drivers/mtd/spi-nor/fsl_qspi.c: spi-nor controller driver(mtd uclass) Changes for v6: - Fixed git bisectable issues, with buildman. - Fixed spi-nor compilation issues - newly designed changes. Changes for v5: - newly designed changes Testing: $ git clone git://git.denx.de/u-boot-spi.git $ cd u-boot-spi $ git checkout -b spi-nor origin/spi-nor Jagan Teki (76): mtd: Add m25p80 driver mtd: Add Kconfig entry for MTD_M25P80 mtd: Add SPI-NOR core support doc: device-tree-bindings: jedec,spi-nor mtd: spi-nor: Add Kconfig entry for MTD_SPI_NOR mtd: spi-nor: Add kconfig for MTD_SPI_NOR_USE_4K_SECTORS mtd: spi-nor: Add MTD support mtd: spi-nor: Add spi_nor support in m25p80 mtd: spi-nor: Add dm spi-nor probing mtd: spi-nor: Add spi_flash_probe for mtd-dm-spi-nor mtd: spi-nor: Add spi_flash_free for mtd-dm-spi-nor mtd: spi-nor: m25p80: Add spi_nor support for non-dm sf: Rename erase_size to erasesize sf: Use erasesize instead of sector_size sf: Use uint64_t for flash->size spi_flash: Use mtd_info operation for SPI-NOR spi_flash: Use spi_flash_t instead of struct spi_flash mtd: spi-nor: Move spi_read_then_write to spi layer spi: Rename spi_read_then_write to spi_write_then_read mtd: spi-nor: Rename SPI_FLASH_BAR to SPI_NOR_BAR mtd: spi-nor: Add Kconfig entry for SPI_NOR_BAR mtd: spi-nor: Copy spl files from drivers/mtd/spi mtd: spi-nor: spl: Follow ascending order of include headers mtd: spi-nor: fsl_espi_spl: Use mtd_info mtd: spi-nor: spi_spl_load: Use mtd_info mtd: spi-nor: Add flash vendor Kconfig entries arm: zynq: Kconfig: Select MTD uclass arm: zynq: Kconfig: Drop DM_SPI_FLASH defconfigs: zynq_microzed: Drop CONFIG_SPI_FLASH defconfig: zynq_microzed: Enable CONFIG_MTD_M25P80 defconfig: zynq_microzed: Enable CONFIG_MTD_SPI_NOR spl: Add CONFIG_SPL_SPI_NOR_SUPPORT
Re: [U-Boot] [PATCH v6 00/76] mtd: Add SPI-NOR core support
On 29 February 2016 at 18:04, Fabio Estevam wrote: > On Mon, Feb 29, 2016 at 9:27 AM, Jagan Teki wrote: > >> Please verify 'sf protect' as well if you haven't tested. > > I tested it last week and it worked fine. OK, thanks! -- Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 0/5] dm: omap3_spi: Convert to driver model
Christophe/All, On 22 February 2016 at 18:11, Jagan Teki wrote: > Christophe, > > Please test this series if you have hw. > > On 22 February 2016 at 18:09, Jagan Teki wrote: >> Changes for v4: >> - rebase to master >> Changes for v3: >> - Add DECLARE_GLOBAL_DATA_PTR >> Changes for v2: >> - Added dm pindir-d0-out-d1-in logic >> - Updated comment about 4-wire master mode as per Linux. >> >> Christophe Ricard (2): >> spi: omap3: Remove unused variable irqstatus in omap3_spi_txrx >> spi: spi-uclass: Set slave wordlen with SPI_DEFAULT_WORDLEN >> >> Jagan Teki (3): >> spi: omap3: Move headers code inside the driver >> spi: omap3: Make local functions as static >> spi: omap3: Convert to driver model Can any one test these 3 patches? thanks! -- Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
V1 I changed all the platform data to explicitly name the entries instead of just using a table of numbers. This would hopefully address future proofing against the header changing order. I copy-pasted the table from my board to a series of boards and then later realized I had accidentally changed the UART number which would have broken a few boards. V2, Fixes that issue because igep, overo, beagle and devkit8000 used UART3 instead of UART1, so it was a correction on my part. The change from V1 was kept, but the correct UART was referenced. On Mon, Feb 29, 2016 at 6:29 AM, Heiko Schocher wrote: > Hello Adam, > > Am 29.02.2016 um 12:53 schrieb Adam Ford: >> >> V2: I hastily copy-pasted the boards without looking at the UART number. >> This addresses 3 boards that use UART3 and not UART1. >> >> With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset >> property" >> reg_offset is added to the struct ns16550_platdata to be >> dt compatible with Linux kernel driver. A variety of OMAP3 boards are >> broken >> as the serial platdata is missing offsets. By explicitly naming the entry, >> this should also help 'future-proof' if more entries get added but are not >> needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. >> >> I only changed a handful of devices that used the same syntax as the Logic >> board. Appologies if I missed one or stepped on toes. Thanks to Derald >> Woods >> and Alexander Graf. >> >> Signed-off-by: Adam Ford >> --- >> board/isee/igep00x0/igep00x0.c | 7 --- >> board/logicpd/omap3som/omap3logic.c | 7 --- >> board/logicpd/zoom1/zoom1.c | 7 --- >> board/overo/overo.c | 7 --- >> board/quipos/cairo/cairo.c | 7 --- >> board/ti/beagle/beagle.c| 7 --- >> board/timll/devkit8000/devkit8000.c | 7 --- >> 7 files changed, 28 insertions(+), 21 deletions(-) > > > What has changed exactly in v2 ? > > Beside of this: > Reviewed-by: Heiko Schocher > > Thanks! > > bye, > Heiko > >> >> diff --git a/board/isee/igep00x0/igep00x0.c >> b/board/isee/igep00x0/igep00x0.c >> index e2fce50..63489e5 100644 >> --- a/board/isee/igep00x0/igep00x0.c >> +++ b/board/isee/igep00x0/igep00x0.c >> @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { >> #endif >> >> static const struct ns16550_platdata igep_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> >> U_BOOT_DEVICE(igep_uart) = { >> diff --git a/board/logicpd/omap3som/omap3logic.c >> b/board/logicpd/omap3som/omap3logic.c >> index 668f684..0e72a5a 100644 >> --- a/board/logicpd/omap3som/omap3logic.c >> +++ b/board/logicpd/omap3som/omap3logic.c >> @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; >>*/ >> >> static const struct ns16550_platdata omap3logic_serial = { >> - OMAP34XX_UART1, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> >> U_BOOT_DEVICE(omap3logic_uart) = { >> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c >> index 4040114..3d34919 100644 >> --- a/board/logicpd/zoom1/zoom1.c >> +++ b/board/logicpd/zoom1/zoom1.c >> @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { >> }; >> >> static const struct ns16550_platdata zoom1_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> >> U_BOOT_DEVICE(zoom1_uart) = { >> diff --git a/board/overo/overo.c b/board/overo/overo.c >> index a38b959..3da80e9 100644 >> --- a/board/overo/overo.c >> +++ b/board/overo/overo.c >> @@ -68,9 +68,10 @@ static struct { >> } expansion_config = {0x0}; >> >> static const struct ns16550_platdata overo_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART3, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> >> U_BOOT_DEVICE(overo_uart) = { >> diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c >> index 21793e8..15d68c1 100644 >> --- a/board/quipos/cairo/cairo.c >> +++ b/board/quipos/cairo/cairo.c >> @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings >> *timings) >> #endif >> >> static const struct ns16550_platdata cairo_serial = { >> - OMAP34XX_UART2, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> >> U_BOOT_DEVICE(cairo_uart) = { >> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c >> index ff317ef..a5f2af7 100644 >> --- a/board/ti/beagle/beagle.c >> +++ b/board/ti/beagle/beagle.c >> @@ -73,9
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
On 02/29/2016 12:53 PM, Adam Ford wrote: V2: I hastily copy-pasted the boards without looking at the UART number. This addresses 3 boards that use UART3 and not UART1. With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver. A variety of OMAP3 boards are broken as the serial platdata is missing offsets. By explicitly naming the entry, this should also help 'future-proof' if more entries get added but are not needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. I only changed a handful of devices that used the same syntax as the Logic board. Appologies if I missed one or stepped on toes. Thanks to Derald Woods and Alexander Graf. Signed-off-by: Adam Ford --- board/isee/igep00x0/igep00x0.c | 7 --- board/logicpd/omap3som/omap3logic.c | 7 --- board/logicpd/zoom1/zoom1.c | 7 --- board/overo/overo.c | 7 --- board/quipos/cairo/cairo.c | 7 --- board/ti/beagle/beagle.c| 7 --- board/timll/devkit8000/devkit8000.c | 7 --- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e2fce50..63489e5 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { #endif static const struct ns16550_platdata igep_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, This looks wrong + .reg_offset = 0, I'd say just leave reg_offset out in all the structs. It gets initialized to 0 by default. + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(igep_uart) = { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 668f684..0e72a5a 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; */ static const struct ns16550_platdata omap3logic_serial = { - OMAP34XX_UART1, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(omap3logic_uart) = { diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index 4040114..3d34919 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { }; static const struct ns16550_platdata zoom1_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, looks wrong too + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(zoom1_uart) = { diff --git a/board/overo/overo.c b/board/overo/overo.c index a38b959..3da80e9 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -68,9 +68,10 @@ static struct { } expansion_config = {0x0}; static const struct ns16550_platdata overo_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(overo_uart) = { diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c index 21793e8..15d68c1 100644 --- a/board/quipos/cairo/cairo.c +++ b/board/quipos/cairo/cairo.c @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) #endif static const struct ns16550_platdata cairo_serial = { - OMAP34XX_UART2, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, wrong? Given the number of typos, maybe try and create a coccinelle script instead? :) Alex + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(cairo_uart) = { diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ff317ef..a5f2af7 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -73,9 +73,10 @@ static struct { } expansion_config; static const struct ns16550_platdata beagle_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(beagle_uart) = { diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 1a447c7..fb8e357 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -46,9 +46,10 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { }; static const struct ns16550_platdata devkit8000_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_
Re: [U-Boot] [PATCH 03/17] drivers: usb: musb: add ti musb misc driver for wrapper
On Monday 29 February 2016 05:32 PM, Marek Vasut wrote: > On 02/29/2016 04:44 AM, Mugunthan V N wrote: >> Add a misc driver for MUSB wrapper, so that based on dr_mode the >> USB devices can bind to USB host or USB device drivers. >> >> Signed-off-by: Mugunthan V N >> --- >> drivers/usb/musb-new/Kconfig | 9 + >> drivers/usb/musb-new/Makefile | 1 + >> drivers/usb/musb-new/ti-musb.c | 89 >> ++ >> 3 files changed, 99 insertions(+) >> create mode 100644 drivers/usb/musb-new/ti-musb.c >> >> diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig >> index 6a6cb93..2bcc646 100644 >> --- a/drivers/usb/musb-new/Kconfig >> +++ b/drivers/usb/musb-new/Kconfig >> @@ -13,6 +13,15 @@ config USB_MUSB_GADGET >> help >>Enables the MUSB USB dual-role controller in gadget mode. >> >> +config USB_MUSB_TI >> +bool "Enable TI OTG USB controller" >> +depends on DM_USB >> +default y >> +help >> + Say y here to enable support for the TI OTG USB controller >> + used on TI SoCs. fadsf fa fad af adf adf asf adfa fad fd af >> + asdf asdf fadsf asf s >> + >> if USB_MUSB_HOST || USB_MUSB_GADGET >> >> config USB_MUSB_SUNXI >> diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile >> index 072d516..d137044 100644 >> --- a/drivers/usb/musb-new/Makefile >> +++ b/drivers/usb/musb-new/Makefile >> @@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o >> obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o >> obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o >> obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o >> +obj-$(CONFIG_USB_MUSB_TI) += ti-musb.o >> >> ccflags-y := $(call cc-option,-Wno-unused-variable) \ >> $(call cc-option,-Wno-unused-but-set-variable) \ >> diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c >> new file mode 100644 >> index 000..c1a4952 >> --- /dev/null >> +++ b/drivers/usb/musb-new/ti-musb.c >> @@ -0,0 +1,89 @@ >> +/* >> + * MISC driver for TI MUSB Glue. >> + * >> + * (C) Copyright 2012-2016 >> + * Texas Instruments Incorporated, >> + * >> + * SPDX-License-Identifier: GPL-2.0+ >> + */ >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +DECLARE_GLOBAL_DATA_PTR; >> + >> +#ifdef CONFIG_DM_USB >> + >> +static const char *const usb_dr_modes[] = { >> +[USB_DR_MODE_UNKNOWN] = "", > > This should probably be "unknown" and not empty string. I just the followed the Linux way of DT parse implementation. Regards Mugunthan V N ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/17] drivers: usb: musb: adopt musb backend driver to driver model
On Monday 29 February 2016 05:34 PM, Marek Vasut wrote: > On 02/29/2016 04:44 AM, Mugunthan V N wrote: >> Currently all backend driver ops uses hard coded physical >> address, so to adopt the driver to DM, add device pointer to ops >> call backs so that drivers that drivers can get physical >> addresses from the usb driver priv/plat data. >> >> Signed-off-by: Mugunthan V N >> --- > > [...] > >> @@ -704,8 +719,13 @@ static int dsps_resume(struct device *dev) >> struct omap_musb_board_data *data = plat->board_data; >> >> /* Start the on-chip PHY and its PLL. */ >> +#ifndef CONFIG_DM_USB >> if (data->set_phy_power) >> data->set_phy_power(1); >> +#else >> +if (data->set_phy_power) >> +data->set_phy_power(data->dev, 1); > > Would it be possible to avoid adding this sea of ifdefs into the driver? > May be introducing a void pointer and pass it back in ops callback can avoid ifdefs. For non DM mode, it will be holding NULL pointer and for DM mode it will be holding a dev pointer. If its ok, I can fix in v2. Regards Mugunthan V N ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
Hello Adam, Am 29.02.2016 um 13:51 schrieb Adam Ford: V1 I changed all the platform data to explicitly name the entries instead of just using a table of numbers. This would hopefully address future proofing against the header changing order. I copy-pasted the table from my board to a series of boards and then later realized I had accidentally changed the UART number which would have broken a few boards. V2, Fixes that issue because igep, overo, beagle and devkit8000 used UART3 instead of UART1, so it was a correction on my part. The change from V1 was kept, but the correct UART was referenced. Please add this information below the "---" in your next version, thanks! Maybe you want to try "u-boot:tools/patman/patman", which helps a lot bye, Heiko On Mon, Feb 29, 2016 at 6:29 AM, Heiko Schocher wrote: Hello Adam, Am 29.02.2016 um 12:53 schrieb Adam Ford: V2: I hastily copy-pasted the boards without looking at the UART number. This addresses 3 boards that use UART3 and not UART1. With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset property" reg_offset is added to the struct ns16550_platdata to be dt compatible with Linux kernel driver. A variety of OMAP3 boards are broken as the serial platdata is missing offsets. By explicitly naming the entry, this should also help 'future-proof' if more entries get added but are not needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. I only changed a handful of devices that used the same syntax as the Logic board. Appologies if I missed one or stepped on toes. Thanks to Derald Woods and Alexander Graf. Signed-off-by: Adam Ford --- board/isee/igep00x0/igep00x0.c | 7 --- board/logicpd/omap3som/omap3logic.c | 7 --- board/logicpd/zoom1/zoom1.c | 7 --- board/overo/overo.c | 7 --- board/quipos/cairo/cairo.c | 7 --- board/ti/beagle/beagle.c| 7 --- board/timll/devkit8000/devkit8000.c | 7 --- 7 files changed, 28 insertions(+), 21 deletions(-) What has changed exactly in v2 ? Beside of this: Reviewed-by: Heiko Schocher Thanks! bye, Heiko diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index e2fce50..63489e5 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { #endif static const struct ns16550_platdata igep_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(igep_uart) = { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 668f684..0e72a5a 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; */ static const struct ns16550_platdata omap3logic_serial = { - OMAP34XX_UART1, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(omap3logic_uart) = { diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index 4040114..3d34919 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { }; static const struct ns16550_platdata zoom1_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(zoom1_uart) = { diff --git a/board/overo/overo.c b/board/overo/overo.c index a38b959..3da80e9 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -68,9 +68,10 @@ static struct { } expansion_config = {0x0}; static const struct ns16550_platdata overo_serial = { - OMAP34XX_UART3, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART3, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(overo_uart) = { diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c index 21793e8..15d68c1 100644 --- a/board/quipos/cairo/cairo.c +++ b/board/quipos/cairo/cairo.c @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) #endif static const struct ns16550_platdata cairo_serial = { - OMAP34XX_UART2, - 2, - V_NS16550_CLK + .base = OMAP34XX_UART1, + .reg_offset = 0, + .reg_shift = 2, + .clock = V_NS16550_CLK }; U_BOOT_DEVICE(cairo_uart) = { diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ff317ef..a5f2af7 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -73,9 +73,10 @@ static struct { } expansion_config; static const struct ns16550_platdata beagle_serial = { - OMAP34XX_UART3, -
[U-Boot] [PATCH 2/3] am335x-bbw: Add am335x_bone_defconfig using CONFIG_DM
Add config file for AM335x Beagle Bone White and enable DM, DM_GPIO, DM_SERIAL, DM_ETH and DM_MMC. Signed-off-by: Mugunthan V N --- arch/arm/dts/Makefile | 4 +++- configs/am335x_bone_defconfig | 27 +++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 configs/am335x_bone_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 578038b..a0a3e2e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -79,7 +79,9 @@ dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \ zynq-zc770-xm013.dtb dtb-$(CONFIG_ARCH_ZYNQMP) += \ zynqmp-ep108.dtb -dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-evm.dtb +dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb \ + am335x-evm.dtb \ + am335x-bone.dtb dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb diff --git a/configs/am335x_bone_defconfig b/configs/am335x_bone_defconfig new file mode 100644 index 000..0223510 --- /dev/null +++ b/configs/am335x_bone_defconfig @@ -0,0 +1,27 @@ +CONFIG_ARM=y +CONFIG_TARGET_AM335X_EVM=y +CONFIG_SPL_STACK_R_ADDR=0x8200 +CONFIG_DEFAULT_DEVICE_TREE="am335x-bone" +CONFIG_SPL=y +CONFIG_SPL_STACK_R=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_FIT_SIGNATURE=y +CONFIG_SYS_EXTRA_OPTIONS="ENV_IS_IN_FAT" +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" +CONFIG_AUTOBOOT_DELAY_STR="d" +CONFIG_AUTOBOOT_STOP_STR=" " +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_OF_CONTROL=y +CONFIG_DM_MMC=y +CONFIG_DM_GPIO=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DM_ETH=y +CONFIG_SYS_NS16550=y +CONFIG_TIMER=y +CONFIG_OMAP_TIMER=y -- 2.7.2.333.g70bd996 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/3] device model bringup of AM335x bbw and sk-evm
This patch series enables Driver Model and Device tree usage for AM335x Beagle Bone White and AM335x EVMsk tested it on same with loading file from MMC and over TFTP. (Loga [1]). Also pushed a branch [2] for reference. [1]: http://pastebin.ubuntu.com/15243394/ [2]: git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git am335x-dm Mugunthan V N (3): include: configs: am335x_evm: add FAT_ENV configs when env is in fat am335x-bbw: Add am335x_bone_defconfig using CONFIG_DM am437x-sk: add am335x_gp_evm_defconfig using CONFIG_DM arch/arm/dts/Makefile | 5 +- arch/arm/dts/am335x-evmsk.dts | 720 configs/am335x_bone_defconfig | 27 ++ configs/am335x_sk_evm_defconfig | 27 ++ include/configs/am335x_evm.h| 6 + 5 files changed, 784 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/am335x-evmsk.dts create mode 100644 configs/am335x_bone_defconfig create mode 100644 configs/am335x_sk_evm_defconfig -- 2.7.2.333.g70bd996 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] include: configs: am335x_evm: add FAT_ENV configs when env is in fat
When CONFIG_ENV_IS_IN_FAT is defined, define FAT_ENV configurations for storing the environment setup. Signed-off-by: Mugunthan V N --- include/configs/am335x_evm.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 6ebe0b3..5cc6b73 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -39,6 +39,12 @@ /* Custom script for NOR */ #define CONFIG_SYS_LDSCRIPT"board/ti/am335x/u-boot.lds" +#ifdef CONFIG_ENV_IS_IN_FAT +#define FAT_ENV_INTERFACE "mmc" +#define FAT_ENV_DEVICE_AND_PART"0:1" +#define FAT_ENV_FILE "uboot.env" +#endif + /* Always 128 KiB env size */ #define CONFIG_ENV_SIZE(128 << 10) -- 2.7.2.333.g70bd996 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] am437x-sk: add am335x_gp_evm_defconfig using CONFIG_DM
Import DT file for am335x-sk-evm from Linux Kernel v4.4 Add config file for this board, enable DM, DM_GPIO, DM_SERIAL, DM_ETH and DM_MMC. Signed-off-by: Mugunthan V N --- arch/arm/dts/Makefile | 1 + arch/arm/dts/am335x-evmsk.dts | 720 configs/am335x_sk_evm_defconfig | 27 ++ 3 files changed, 748 insertions(+) create mode 100644 arch/arm/dts/am335x-evmsk.dts create mode 100644 configs/am335x_sk_evm_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a0a3e2e..2542930 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -81,6 +81,7 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \ zynqmp-ep108.dtb dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb \ am335x-evm.dtb \ + am335x-evmsk.dtb \ am335x-bone.dtb dtb-$(CONFIG_AM43XX) += am437x-gp-evm.dtb am437x-sk-evm.dtb dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb diff --git a/arch/arm/dts/am335x-evmsk.dts b/arch/arm/dts/am335x-evmsk.dts new file mode 100644 index 000..e3fd284 --- /dev/null +++ b/arch/arm/dts/am335x-evmsk.dts @@ -0,0 +1,720 @@ +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * AM335x Starter Kit + * http://www.ti.com/tool/tmdssk3358 + */ + +/dts-v1/; + +#include "am33xx.dtsi" +#include +#include + +/ { + model = "TI AM335x EVM-SK"; + compatible = "ti,am335x-evmsk", "ti,am33xx"; + + chosen { + stdout-path = &uart0; + tick-timer = &timer2; + }; + + cpus { + cpu@0 { + cpu0-supply = <&vdd1_reg>; + }; + }; + + memory { + device_type = "memory"; + reg = <0x8000 0x1000>; /* 256 MB */ + }; + + vbat: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vbat"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + }; + + lis3_reg: fixedregulator@1 { + compatible = "regulator-fixed"; + regulator-name = "lis3_reg"; + regulator-boot-on; + }; + + wl12xx_vmmc: fixedregulator@2 { + pinctrl-names = "default"; + pinctrl-0 = <&wl12xx_gpio>; + compatible = "regulator-fixed"; + regulator-name = "vwl1271"; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <180>; + gpio = <&gpio1 29 0>; + startup-delay-us = <7>; + enable-active-high; + }; + + vtt_fixed: fixedregulator@3 { + compatible = "regulator-fixed"; + regulator-name = "vtt"; + regulator-min-microvolt = <150>; + regulator-max-microvolt = <150>; + gpio = <&gpio0 7 GPIO_ACTIVE_HIGH>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + }; + + leds { + pinctrl-names = "default"; + pinctrl-0 = <&user_leds_s0>; + + compatible = "gpio-leds"; + + led@1 { + label = "evmsk:green:usr0"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@2 { + label = "evmsk:green:usr1"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led@3 { + label = "evmsk:green:mmc0"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mmc0"; + default-state = "off"; + }; + + led@4 { + label = "evmsk:green:heartbeat"; + gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + default-state = "off"; + }; + }; + + gpio_buttons: gpio_buttons@0 { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + switch@1 { + label = "button0"; + linux,code = <0x100>; + gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; + }; + + switch@2 { + label = "button1"; + linux,code = <0x101>; + gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; + }; + + switch@3 { + l
Re: [U-Boot] [PATCH 0/3] device model bringup of AM335x bbw and sk-evm
On Mon, Feb 29, 2016 at 07:28:26PM +0530, Mugunthan V N wrote: > This patch series enables Driver Model and Device tree usage for > AM335x Beagle Bone White and AM335x EVMsk tested it on same with > loading file from MMC and over TFTP. (Loga [1]). Also pushed a > branch [2] for reference. > > [1]: http://pastebin.ubuntu.com/15243394/ > [2]: git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git am335x-dm I really want to hold off on doing more am335x DM conversions until we pull in Simon's series that lets us do FIT images in SPL and thus we can have all of the am335x family at least (and maybe more, we'll have to see) supported in a single build again, like we can in the non-DM case. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] pull request: u-boot-uniphier/master
On Mon, Feb 29, 2016 at 06:06:10PM +0900, Masahiro Yamada wrote: > Hi Tom, > > I found a small bug in this series. > > If it is not too late, please let me fix it and do a 2nd round. > > If it is, it's OK, I will send a follow-up patch. Yes, OK, thanks. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/17] drivers: usb: musb: adopt musb backend driver to driver model
On 02/29/2016 02:26 PM, Mugunthan V N wrote: > On Monday 29 February 2016 05:34 PM, Marek Vasut wrote: >> On 02/29/2016 04:44 AM, Mugunthan V N wrote: >>> Currently all backend driver ops uses hard coded physical >>> address, so to adopt the driver to DM, add device pointer to ops >>> call backs so that drivers that drivers can get physical >>> addresses from the usb driver priv/plat data. >>> >>> Signed-off-by: Mugunthan V N >>> --- >> >> [...] >> >>> @@ -704,8 +719,13 @@ static int dsps_resume(struct device *dev) >>> struct omap_musb_board_data *data = plat->board_data; >>> >>> /* Start the on-chip PHY and its PLL. */ >>> +#ifndef CONFIG_DM_USB >>> if (data->set_phy_power) >>> data->set_phy_power(1); >>> +#else >>> + if (data->set_phy_power) >>> + data->set_phy_power(data->dev, 1); >> >> Would it be possible to avoid adding this sea of ifdefs into the driver? >> > > May be introducing a void pointer and pass it back in ops callback can > avoid ifdefs. For non DM mode, it will be holding NULL pointer and for > DM mode it will be holding a dev pointer. If its ok, I can fix in v2. That looks a bit more sensible, yes. I am worried about problems with dereferencing the data->dev pointer though. But let's see. -- 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 03/17] drivers: usb: musb: add ti musb misc driver for wrapper
On Mon, Feb 29, 2016 at 06:51:32PM +0530, Mugunthan V N wrote: > On Monday 29 February 2016 05:32 PM, Marek Vasut wrote: > > On 02/29/2016 04:44 AM, Mugunthan V N wrote: > >> Add a misc driver for MUSB wrapper, so that based on dr_mode the > >> USB devices can bind to USB host or USB device drivers. > >> > >> Signed-off-by: Mugunthan V N > >> --- > >> drivers/usb/musb-new/Kconfig | 9 + > >> drivers/usb/musb-new/Makefile | 1 + > >> drivers/usb/musb-new/ti-musb.c | 89 > >> ++ > >> 3 files changed, 99 insertions(+) > >> create mode 100644 drivers/usb/musb-new/ti-musb.c > >> > >> diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig > >> index 6a6cb93..2bcc646 100644 > >> --- a/drivers/usb/musb-new/Kconfig > >> +++ b/drivers/usb/musb-new/Kconfig > >> @@ -13,6 +13,15 @@ config USB_MUSB_GADGET > >>help > >> Enables the MUSB USB dual-role controller in gadget mode. > >> > >> +config USB_MUSB_TI > >> + bool "Enable TI OTG USB controller" > >> + depends on DM_USB > >> + default y > >> + help > >> +Say y here to enable support for the TI OTG USB controller > >> +used on TI SoCs. fadsf fa fad af adf adf asf adfa fad fd af > >> + asdf asdf fadsf asf s > >> + > >> if USB_MUSB_HOST || USB_MUSB_GADGET > >> > >> config USB_MUSB_SUNXI > >> diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile > >> index 072d516..d137044 100644 > >> --- a/drivers/usb/musb-new/Makefile > >> +++ b/drivers/usb/musb-new/Makefile > >> @@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o > >> obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o > >> obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o > >> obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o > >> +obj-$(CONFIG_USB_MUSB_TI) += ti-musb.o > >> > >> ccflags-y := $(call cc-option,-Wno-unused-variable) \ > >>$(call cc-option,-Wno-unused-but-set-variable) \ > >> diff --git a/drivers/usb/musb-new/ti-musb.c > >> b/drivers/usb/musb-new/ti-musb.c > >> new file mode 100644 > >> index 000..c1a4952 > >> --- /dev/null > >> +++ b/drivers/usb/musb-new/ti-musb.c > >> @@ -0,0 +1,89 @@ > >> +/* > >> + * MISC driver for TI MUSB Glue. > >> + * > >> + * (C) Copyright 2012-2016 > >> + * Texas Instruments Incorporated, > >> + * > >> + * SPDX-License-Identifier: GPL-2.0+ > >> + */ > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> + > >> +DECLARE_GLOBAL_DATA_PTR; > >> + > >> +#ifdef CONFIG_DM_USB > >> + > >> +static const char *const usb_dr_modes[] = { > >> + [USB_DR_MODE_UNKNOWN] = "", > > > > This should probably be "unknown" and not empty string. > > I just the followed the Linux way of DT parse implementation. OK, that sounds like a good reason to keep it the way you did it then. -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 03/17] drivers: usb: musb: add ti musb misc driver for wrapper
On 02/29/2016 03:42 PM, Tom Rini wrote: > On Mon, Feb 29, 2016 at 06:51:32PM +0530, Mugunthan V N wrote: >> On Monday 29 February 2016 05:32 PM, Marek Vasut wrote: >>> On 02/29/2016 04:44 AM, Mugunthan V N wrote: Add a misc driver for MUSB wrapper, so that based on dr_mode the USB devices can bind to USB host or USB device drivers. Signed-off-by: Mugunthan V N --- drivers/usb/musb-new/Kconfig | 9 + drivers/usb/musb-new/Makefile | 1 + drivers/usb/musb-new/ti-musb.c | 89 ++ 3 files changed, 99 insertions(+) create mode 100644 drivers/usb/musb-new/ti-musb.c diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig index 6a6cb93..2bcc646 100644 --- a/drivers/usb/musb-new/Kconfig +++ b/drivers/usb/musb-new/Kconfig @@ -13,6 +13,15 @@ config USB_MUSB_GADGET help Enables the MUSB USB dual-role controller in gadget mode. +config USB_MUSB_TI + bool "Enable TI OTG USB controller" + depends on DM_USB + default y + help +Say y here to enable support for the TI OTG USB controller +used on TI SoCs. fadsf fa fad af adf adf asf adfa fad fd af + asdf asdf fadsf asf s + if USB_MUSB_HOST || USB_MUSB_GADGET config USB_MUSB_SUNXI diff --git a/drivers/usb/musb-new/Makefile b/drivers/usb/musb-new/Makefile index 072d516..d137044 100644 --- a/drivers/usb/musb-new/Makefile +++ b/drivers/usb/musb-new/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o +obj-$(CONFIG_USB_MUSB_TI) += ti-musb.o ccflags-y := $(call cc-option,-Wno-unused-variable) \ $(call cc-option,-Wno-unused-but-set-variable) \ diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c new file mode 100644 index 000..c1a4952 --- /dev/null +++ b/drivers/usb/musb-new/ti-musb.c @@ -0,0 +1,89 @@ +/* + * MISC driver for TI MUSB Glue. + * + * (C) Copyright 2012-2016 + * Texas Instruments Incorporated, + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#ifdef CONFIG_DM_USB + +static const char *const usb_dr_modes[] = { + [USB_DR_MODE_UNKNOWN] = "", >>> >>> This should probably be "unknown" and not empty string. >> >> I just the followed the Linux way of DT parse implementation. > > OK, that sounds like a good reason to keep it the way you did it then. Yeah -- 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 05/17] drivers: usb: musb: adopt musb backend driver to driver model
On Mon, Feb 29, 2016 at 02:34:41PM +0100, Marek Vasut wrote: > On 02/29/2016 02:26 PM, Mugunthan V N wrote: > > On Monday 29 February 2016 05:34 PM, Marek Vasut wrote: > >> On 02/29/2016 04:44 AM, Mugunthan V N wrote: > >>> Currently all backend driver ops uses hard coded physical > >>> address, so to adopt the driver to DM, add device pointer to ops > >>> call backs so that drivers that drivers can get physical > >>> addresses from the usb driver priv/plat data. > >>> > >>> Signed-off-by: Mugunthan V N > >>> --- > >> > >> [...] > >> > >>> @@ -704,8 +719,13 @@ static int dsps_resume(struct device *dev) > >>> struct omap_musb_board_data *data = plat->board_data; > >>> > >>> /* Start the on-chip PHY and its PLL. */ > >>> +#ifndef CONFIG_DM_USB > >>> if (data->set_phy_power) > >>> data->set_phy_power(1); > >>> +#else > >>> + if (data->set_phy_power) > >>> + data->set_phy_power(data->dev, 1); > >> > >> Would it be possible to avoid adding this sea of ifdefs into the driver? > >> > > > > May be introducing a void pointer and pass it back in ops callback can > > avoid ifdefs. For non DM mode, it will be holding NULL pointer and for > > DM mode it will be holding a dev pointer. If its ok, I can fix in v2. > > That looks a bit more sensible, yes. I am worried about problems with > dereferencing the data->dev pointer though. But let's see. Maybe looking at how Jagan has the SPI stuff separated to allow for DM/non-DM but without a lot of ifdefs can help here too? -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] Revert "dm: ns16550: Add support for reg-offset property"
This reverts commit d9a3bec682f9756621615f4306718a356a3230e3. While this is a correct change to do long term it unfortunately breaks a number of platforms that are using pdata and not named struct members so they are getting all of their data after 'base' incorrect. Acked-by: Michal Simek Signed-off-by: Tom Rini --- drivers/serial/ns16550.c |6 ++ include/ns16550.h|1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 28da9dd..93dad33 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -105,7 +105,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value) * As far as we know it doesn't make sense to support selection of * these options at run-time, so use the existing CONFIG options. */ - serial_out_shift(addr + plat->reg_offset, plat->reg_shift, value); + serial_out_shift(addr, plat->reg_shift, value); } static int ns16550_readb(NS16550_t port, int offset) @@ -116,7 +116,7 @@ static int ns16550_readb(NS16550_t port, int offset) offset *= 1 << plat->reg_shift; addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset; - return serial_in_shift(addr + plat->reg_offset, plat->reg_shift); + return serial_in_shift(addr, plat->reg_shift); } /* We can clean these up once everything is moved to driver model */ @@ -401,8 +401,6 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev) return -EINVAL; plat->base = addr; - plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, -"reg-offset", 0); plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg-shift", 0); plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, diff --git a/include/ns16550.h b/include/ns16550.h index 5eeacd6..4e62067 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -54,7 +54,6 @@ */ struct ns16550_platdata { unsigned long base; - int reg_offset; int reg_shift; int clock; }; -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Revert "dm: ns16550: Add support for reg-offset property"
On Mon, Feb 29, 2016 at 10:29:21AM -0500, Tom Rini wrote: > This reverts commit d9a3bec682f9756621615f4306718a356a3230e3. > > While this is a correct change to do long term it unfortunately breaks a > number of platforms that are using pdata and not named struct members so > they are getting all of their data after 'base' incorrect. > > Acked-by: Michal Simek > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: Digital signature ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] pull request: u-boot-uniphier/master (2nd round)
Hi Tom, Here is a bunch of UniPhier updates which include GPIO driver support, MMC driver support, DRAM init code clean-ups, etc. Please pull. Changes for 2nd round: - Fix a build error when CONFIG_DEBUG_LL is defined The following changes since commit 50dc8677d769be6e2b34f49b6c43ad1e977bdc51: Merge git://git.denx.de/u-boot-usb (2016-02-26 18:08:43 -0500) are available in the git repository at: git://git.denx.de/u-boot-uniphier.git master for you to fetch changes up to 11d3ede42ceccef9b5941ea7907f398cb97ed361: ARM: uniphier: fix warnings reported by aarch64 compiler (2016-03-01 00:33:29 +0900) Masahiro Yamada (38): ARM: dts: uniphier: rework System Bus nodes gpio: uniphier: add driver for UniPhier GPIO controller gpio: do not include for UniPhier ARM: uniphier: enable GPIO command and driver for UniPhier SoCs ARM: dts: uniphier: add GPIO controller nodes mmc: uniphier: add driver for UniPhier SD/MMC host controller ARM: uniphier: enable UniPhier SD/MMC host driver ARM: dts: uniphier: add SD/MMC host controller nodes ARM: uniphier: add eMMC boot support ARM: uniphier: add a command to find the first MMC (non-SD) device ARM: uniphier: add emmcupdate command ARM: uniphier: default to environment in eMMC ARM: uniphier: remove unused umc_polling() ARM: uniphier: rework struct uniphier_board_data ARM: uniphier: optimize ProXstream2 UMC init code with "for" loop ARM: uniphier: use pr_err() where possible ARM: uniphier: refactor UMC init code for ProXstream2 ARM: uniphier: remove UMC_INITCTL* and UMC_DRMR* settings ARM: uniphier: disable debug circuit clocks for PH1-Pro4 ARM: uniphier: add a field to specify DDR3+ ARM: uniphier: merge DDR PHY init code for 3 SoCs ARM: uniphier: remove unused argument of ph1_ld4_ddrphy_init() ARM: uniphier: refactor DDR-PHY init code ARM: uniphier: refactor UMC init code for PH1-sLD8 ARM: uniphier: support more DRAM use cases for PH1-sLD8 ARM: uniphier: refactor UMC init code for PH1-LD4 ARM: uniphier: optimize PH1-sLD8 UMC init code with "for" loop ARM: uniphier: optimize PH1-LD4 UMC init code with "for" loop ARM: uniphier: optimize PH1-Pro4 UMC init code with "for" loop ARM: uniphier: rework DRAM size handling in UMC init code ARM: uniphier: remove unused macros for UMC base addresses ARM: uniphier: deprecate umc_dram_init_{start, poll} ARM: uniphier: rename variable for DRAM controller base address ARM: uniphier: merge two defconfig files ARM: uniphier: rework UniPhier SoC select in Kconfig ARM: uniphier: rename PH1-LD10/PH1-sLD11 to PH1-LD20/PH1-LD11 ARM: uniphier: prepare directory structure for ARMv8 SoC support ARM: uniphier: fix warnings reported by aarch64 compiler arch/arm/Kconfig| 3 +- arch/arm/dts/uniphier-common32.dtsi | 19 +- arch/arm/dts/uniphier-ph1-ld4-ref.dts | 4 + arch/arm/dts/uniphier-ph1-ld4.dtsi | 137 + arch/arm/dts/uniphier-ph1-ld6b-ref.dts | 4 + arch/arm/dts/uniphier-ph1-pro4-ace.dts | 4 + arch/arm/dts/uniphier-ph1-pro4-ref.dts | 8 + arch/arm/dts/uniphier-ph1-pro4-sanji.dts| 16 + arch/arm/dts/uniphier-ph1-pro4.dtsi | 240 arch/arm/dts/uniphier-ph1-pro5-4kbox.dts| 8 + arch/arm/dts/uniphier-ph1-pro5.dtsi | 227 arch/arm/dts/uniphier-ph1-sld3-ref.dts | 4 + arch/arm/dts/uniphier-ph1-sld3.dtsi | 151 +- arch/arm/dts/uniphier-ph1-sld8-ref.dts | 4 + arch/arm/dts/uniphier-ph1-sld8.dtsi | 137 + arch/arm/dts/uniphier-pinctrl.dtsi | 15 + arch/arm/dts/uniphier-proxstream2-gentil.dts| 16 + arch/arm/dts/uniphier-proxstream2-vodka.dts | 16 + arch/arm/dts/uniphier-proxstream2.dtsi | 220 arch/arm/include/asm/gpio.h | 2 + arch/arm/mach-uniphier/Kconfig | 66 ++- arch/arm/mach-uniphier/Makefile | 9 +- arch/arm/mach-uniphier/arm32/Makefile | 13 + arch/arm/mach-uniphier/{ => arm32}/arm-mpcore.h | 0 arch/arm/mach-uniphier/{ => arm32}/cache_uniphier.c | 0 arch/arm/mach-uniphier/{ => arm32}/debug_ll.S | 6 +- arch/arm/mach-uniphier/{ => arm32}/late_lowlevel_init.S | 0 arch/arm/mach-uniphier/{ => arm32}/lowlevel_init.S | 0 arch/arm/mach-uniphier/{ => arm32}/ssc-regs.h | 0 arch/arm/mach-uniphier/{ => arm32}/timer.c | 0 arch/arm/mach-uniphier/bcu/bcu-ph1-ld4.c|
Re: [U-Boot] Problem with attaching UBI partition
Hi Jagan, Heiko, > Did you enable CONFIG_SPI_FLASH_SPANSION on your config, becuase > S25FL512S is already been added u-boot. Pls- check the same and let me > know if you find any issues while detecting the flash. > Whether the driver detecting flash or not with RDID, please define > DEBUG on drivers/mtd/spi/spi_flash.c I had no problems with detecting the flash. It was detected like this: SF: Detected S25FL512S_256K with page size 512 Bytes, erase size 256 KiB, total 64 MiB Yes, I have CONFIG_SPI_FLASH_SPANSION enabled in configs/socfpga_arria5_dbrrh_defconfig (dbrrh - is my custom board). Actually, today I solved the problem, although in not very clean way, I think. As I mentioned in previous mail I had problems with reading from the flash. Some bytes were read incorrectly. I'm migrating from U-Boot 2013 to mainline U-Boot. And on previous version there were no such issue. I found out that there was some workaround introduced in order to fix this. So, I just apply some part of that workaround to mainline U-Boot and now it works. Here is the problem in more detail: On previous version (2013): U-BOOT # sf read 0x1B00 0x0380 4 cadence_qspi_apb_indirect_read_setup. addr_value = 0x380 cadence_qspi_apb_indirect_read_setup. rd_reg = 0x80b cadence_qspi_apb_indirect_read_setup. device size = 0x101003 U-BOOT # md 0x1B00 1 1b00: 55424923 But on mainline U-Boot(2016.03-rc1) I had: U-BOOT # sf read 0x1B00 0x0380 4 cadence_qspi_apb_indirect_read_setup. addr_value = 0x80 cadence_qspi_apb_indirect_read_setup. rd_reg = 0x0b cadence_qspi_apb_indirect_read_setup. device size = 0x101002 U-BOOT # md 0x1B00 1 1b00: 554249ff You can see the difference in the register values that were written in QSPI registers. In case with mainline U-Boot I had address value not properly set. Here is the workaround that I've made: Index: drivers/mtd/spi/spi_flash.c === --- drivers/mtd/spi/spi_flash.c (revision 608) +++ drivers/mtd/spi/spi_flash.c (revision 609) @@ -29,6 +29,17 @@ cmd[3] = addr >> 0; } +#ifdef CONFIG_DBRRH_WORKAROUND +static void spi_flash_addr32(u32 addr, u8 *cmd) +{ + /* cmd[0] is actual command */ + cmd[1] = (addr >> 24) & 0xFF; + cmd[2] = (addr >> 16) & 0xFF; + cmd[3] = (addr >> 8) & 0xFF; + cmd[4] = (addr >> 0) & 0xFF; +} +#endif + static int read_sr(struct spi_flash *flash, u8 *rs) { int ret; @@ -510,8 +521,14 @@ else read_len = remain_len; +#ifdef CONFIG_DBRRH_WORKAROUND + spi_flash_addr32(read_addr, cmd); +#else spi_flash_addr(read_addr, cmd); +#endif ret = spi_flash_read_common(flash, cmd, cmdsz, data, read_len); if (ret < 0) { debug("SF: read failed\n"); Index: drivers/spi/cadence_qspi_apb.c === --- drivers/spi/cadence_qspi_apb.c (revision 608) +++ drivers/spi/cadence_qspi_apb.c (revision 609) @@ -30,6 +30,10 @@ #include #include "cadence_qspi.h" +#ifdef CONFIG_DBRRH_WORKAROUND + #define CMD_OPTION_DUMMY_CYCLES 0x7F/* Dummy Cycles for Read Command */ +#endif + @@ -706,9 +710,25 @@ #endif /* Get address */ +#ifdef CONFIG_DBRRH_WORKAROUND + addr_value = cadence_qspi_apb_cmd2addr(&cmdbuf[1], 4); +#else addr_value = cadence_qspi_apb_cmd2addr(&cmdbuf[1], addr_bytes); +#endif +#ifdef CONFIG_DBRRH_WORKAROUND + /* Setting Dummy Clock Cycle */ + dummy_clk = (0x08 & CMD_OPTION_DUMMY_CYCLES); + if (dummy_clk) + { + rd_reg |= (dummy_clk & CQSPI_REG_RD_INSTR_DUMMY_MASK) + << CQSPI_REG_RD_INSTR_DUMMY_LSB; + } +#else + /* The remaining lenght is dummy bytes. */ dummy_bytes = cmdlen - addr_bytes - 1; if (dummy_bytes) { @@ -731,7 +751,9 @@ rd_reg |= (dummy_clk & CQSPI_REG_RD_INSTR_DUMMY_MASK) << CQSPI_REG_RD_INSTR_DUMMY_LSB; } +#endif With this correction I can read contents of the flash properly. However, I'm a bit surprised that I was forced to make such correction like storing 4 bytes of address (see spi_flash_addr32() above). On the other hand I haven't found any switch that could be turned on to fix my problem in a clean and nice way. With 24 bytes we can address only 16 MB. How cadence driver is supposed to work for larger spaces? Is this 4th byte comes from somewhere else? Jagan, Heiko, please evaluate my correction. Best regards, Denis Bakhvalov ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/10] arm64: Make full va map code more dynamic
On 02/27/2016 05:09 AM, Alexander Graf wrote: On 26.02.16 20:25, Stephen Warren wrote: On 02/25/2016 09:36 AM, Alexander Graf wrote: On 24.02.16 19:14, Stephen Warren wrote: On 02/24/2016 05:11 AM, Alexander Graf wrote: The idea to generate our pages tables from an array of memory ranges is very sound. However, instead of hard coding the code to create up to 2 levels of 64k granule page tables, we really should just create normal 4k page tables that allow us to set caching attributes on 2M or 4k level later on. So this patch moves the full_va mapping code to 4k page size and makes it fully flexible to dynamically create as many levels as necessary for a map (including dynamic 1G/2M pages). It also adds support to dynamically split a large map into smaller ones when some code wants to set dcache attributes. With all this in place, there is very little reason to create your own page tables in board specific files. Signed-off-by: Alexander Graf +/* + * This is a recursively called function to count the number of + * page tables we need to cover a particular PTE range. If you + * call this with level = -1 you basically get the full 48 bit + * coverage. + */ +static int count_required_pts(u64 addr, int level, u64 maxaddr) I think this looks correct now. Nits below if a respin is needed for other reasons. +{ +int levelshift = level2shift(level); +u64 levelsize = 1ULL << levelshift; +u64 levelmask = levelsize - 1; +u64 levelend = addr + levelsize; +int r = 0; +int i; +bool is_level = false; I might suggest renaming that is_level_needed. It's not obvious to me exactly what the name "is_level" is intended to represent; the name seems to represent whether something (unspecified) is a level or not. We're basically asking the function whether a PTE for address at level would be an inval/block/level PTE. is_level marks it as a level pte. I could maybe rename this into pte_type and create an enum that is either PTE_INVAL, PTE_BLOCK or PTE_LEVEL. + +for (i = 0; i < ARRAY_SIZE(mem_map); i++) { +struct mm_region *map = &mem_map[i]; +u64 start = map->base; +u64 end = start + map->size; + +/* Check if the PTE would overlap with the map */ +if (max(addr, start) <= min(levelend, end)) { +start = max(addr, start); +end = min(levelend, end); + +/* We need a sub-pt for this level */ +if ((start & levelmask) || (end & levelmask)) { +is_level = true; +break; +} + +/* Lv0 can not do block PTEs, so do levels here too */ +if (level <= 0) { +is_level = true; +break; +} +} +} + +/* + * Block PTEs at this level are already covered by the parent page + * table, so we only need to count sub page tables. + */ +if (is_level) { +int sublevel = level + 1; +u64 sublevelsize = 1ULL << level2shift(sublevel); + +/* Account for the new sub page table ... */ +r = 1; "Account for the page table at /this/ level"? This may represent the top-level (0/1) page table, not just sub page tables. The sub-level accounting is via the recursive call to count_required_pts() I believe. I think the easiest way to visualize what's going on is if we start with level -1. We basically ask the function at level -1 whether a PTE at level -1 (48 bits) would fit into a block PTE at level -1 (so the PTE spans all 48 bits) or whether we need to create a new level entry plus page table for it. Hmm, I had overlooked that the call to count_required_pts() passed "start_level - 1" not "start_level". Now that I see that, your explanation makes more sense to me. It'd be nice if some/all of this explanation were comments in the code to aid readers. That said, I would have expected a slightly more direct calculation; why not: int start_level = 0; // or 1 if small VA space total_pts = count_required_pts(start_level); We need to account for the count twice, to have an (immutable) copy of our page tables around when we split them. I think that's just a hard-coded "* 2" there, unless I'm missing your point? total_pts += 4; // "random" number to account for later splits int count_required_pts(int level, ...) { ... includes the address, as I have it today, I guess? int npts = 1; // the table at this level for each pte slot at this level: if a mem_map entry starts/stops within the pte slot: npts += count_required_pts(level + 1, ...); This means we would count some levels multiple times. Imagine two entries from 1G - 1.25G 1.25G - 1.5G With your pseudo-code, we would count for both cases while checking for 1G page table entries. Hence we need to jump out of the loop here and do the counting outside. I don't think so; "if a mem_map entry starts/stops within the pte slot" is a single decision for
[U-Boot] [PATCH] compiler*.h: sync include/linux/compiler*.h with Linux 4.5-rc6
Copy these from Linux v4.5-rc6 tag. This is needed so that we can keep up with newer gcc versions. Note that we don't have the uapi/ hierarchy from the kernel so continue to use Signed-off-by: Tom Rini --- include/linux/compiler-gcc.h | 259 include/linux/compiler-gcc3.h | 23 include/linux/compiler-gcc4.h | 88 -- include/linux/compiler-gcc5.h | 65 -- include/linux/compiler-intel.h |5 + include/linux/compiler.h | 178 +-- 6 files changed, 383 insertions(+), 235 deletions(-) delete mode 100644 include/linux/compiler-gcc3.h delete mode 100644 include/linux/compiler-gcc4.h delete mode 100644 include/linux/compiler-gcc5.h diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index e057bd2..22ab246 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -5,14 +5,28 @@ /* * Common definitions for all gcc versions go here. */ -#define GCC_VERSION (__GNUC__ * 1 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - +#define GCC_VERSION (__GNUC__ * 1 \ ++ __GNUC_MINOR__ * 100 \ ++ __GNUC_PATCHLEVEL__) /* Optimization barrier */ + /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") +/* + * This version is i.e. to prevent dead stores elimination on @ptr + * where gcc and llvm may behave differently when otherwise using + * normal barrier(): while gcc behavior gets along with a normal + * barrier(), llvm needs an explicit input variable to be assumed + * clobbered. The issue is as follows: while the inline asm might + * access any memory it wants, the compiler could have fit all of + * @ptr into memory registers instead, and since @ptr never escaped + * from that, it proofed that the inline asm wasn't touching any of + * it. This version works well with both compilers, i.e. we're telling + * the compiler that the inline asm absolutely may see the contents + * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 + */ +#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") /* * This macro obfuscates arithmetic on a variable address so that gcc @@ -32,58 +46,63 @@ * the inline assembly constraint from =g to =r, in this particular * case either is valid. */ -#define RELOC_HIDE(ptr, off) \ - ({ unsigned long __ptr; \ -__asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ -(typeof(ptr)) (__ptr + (off)); }) +#define RELOC_HIDE(ptr, off) \ +({ \ + unsigned long __ptr;\ + __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ + (typeof(ptr)) (__ptr + (off)); \ +}) /* Make the optimizer believe the variable can be manipulated arbitrarily. */ -#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) +#define OPTIMIZER_HIDE_VAR(var) \ + __asm__ ("" : "=r" (var) : "0" (var)) #ifdef __CHECKER__ -#define __must_be_array(arr) 0 +#define __must_be_array(a) 0 #else /* &a[0] degrades to a pointer: a different type from an array */ -#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) #endif /* * Force always-inline if the user requests it so via the .config, * or if gcc is too old: */ -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ +#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -# define inlineinline __attribute__((always_inline)) notrace -# define __inline____inline__ __attribute__((always_inline)) notrace -# define __inline __inline__attribute__((always_inline)) notrace +#define inline inline __attribute__((always_inline)) notrace +#define __inline__ __inline__ __attribute__((always_inline)) notrace +#define __inline __inline__attribute__((always_inline)) notrace #else /* A lot of inline functions can cause havoc with function tracing */ -# define inlineinline notrace -# define __inline____inline__ notrace -# define __inline __inlinenotrace +#define inline inline notrace +#define __inline__ __inline__ notrace +#define __inline __inlinenotrace #endif -#define __deprecated __attribute__((deprecated)) -#ifndef __packed -#define __packed __attribute__((packed)) -#endif -#ifndef __weak -#define __weak
Re: [U-Boot] [PATCH 2/2] Add support the Avionic Design Meerkat COM and Kein Baseboard
On 02/29/2016 03:20 AM, Julian Scheel wrote: Hi Stephen, On 23.02.2016 19:03, Stephen Warren wrote: On 02/23/2016 05:59 AM, Julian Scheel wrote: Add support for platforms based on the Meerkat COM module. Includes support for the minimal reference platform called Kein Baseboard, which in fact is sufficient to run most existing Meerkat carriers. diff --git a/arch/arm/dts/tegra124-meerkat.dtsi b/arch/arm/dts/tegra124-meerkat.dtsi +aliases { +i2c0 = "/i2c@7000c000"; +i2c1 = "/i2c@7000c400"; +i2c2 = "/i2c@7000c500"; +i2c3 = "/i2c@7000c700"; +i2c4 = "/i2c@7000d000"; +i2c5 = "/i2c@7000d100"; /i2c@7000d000 is alias i2c0 on all other Tegra boards that have I2C aliases. we just had a quick discussion about this and actually we explicitly changed it in our tree to a linear mapping of the controller addresses to be in sync with what we have in the l4t kernel. If it won't hurt you too much we'd like to keep it that way. Though if you feel really bad about it, we can change it to use the same mapping as Jetson uses. That's probably fine; hopefully it won't be too confusing since aliases are supposed to be board-specific. Let's make sure that the Linux kernel patches for this board have matching aliases and get Ack'd soon to make sure they don't diverge. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] placement for new clock drivers
Hi, I have a few questions regarding the UCLASS_CLK driver. I need to implement a clock driver for a new-ish platform, an ARMv7 based SoCFPGA Arria10. I think going forward, it would make sense to place the driver to be of UCLASS_CLK and would go into drivers/clk/, instead of under arch/arm/mach-socfpga directory, Am I correct in assuming that? My 2nd question is regarding the usage of uclass_get_device(UCLASS_CLK). If I have a DTS that is from: arch/arm/dts/socfpga.dtsi Fragment of the clock portion from the DTS here: clkmgr@ffd04000 { compatible = "altr,clk-mgr"; reg = <0xffd04000 0x1000>; clocks { #address-cells = <1>; #size-cells = <0>; osc1: osc1 { #clock-cells = <0>; compatible = "fixed-clock"; clock-frequency = <2500>; }; osc2: osc2 { #clock-cells = <0>; compatible = "fixed-clock"; }; f2s_periph_ref_clk: f2s_periph_ref_clk { #clock-cells = <0>; compatible = "fixed-clock"; }; f2s_sdram_ref_clk: f2s_sdram_ref_clk { #clock-cells = <0>; compatible = "fixed-clock"; }; }; I tried calling uclass_get_device(UCLASS_CLK, 0, dev), thinking that it would return the "fixed-clock" clocks, then I can get the frequencies and move forward with calculating the rest of the clocks. But uclass_get_device() is returning an error for me. I'm sure I might have missed understood how the clock framework is supposed to work somewhere. Can you please point me in the right direction? Thanks, Dinh ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] Problem with attaching UBI partition
+ Marek On 29 February 2016 at 22:14, Bakhvalov, Denis (Nokia - PL/Wroclaw) wrote: > Hi Jagan, Heiko, > >> Did you enable CONFIG_SPI_FLASH_SPANSION on your config, becuase >> S25FL512S is already been added u-boot. Pls- check the same and let me >> know if you find any issues while detecting the flash. > >> Whether the driver detecting flash or not with RDID, please define >> DEBUG on drivers/mtd/spi/spi_flash.c > > I had no problems with detecting the flash. It was detected like this: > SF: Detected S25FL512S_256K with page size 512 Bytes, erase size 256 KiB, > total 64 MiB So, the flash size is > 32MiB means, your config enabled BAR(Bank address register) which means accessing flash more than 16MiB using 3-byte addressing support. > > Yes, I have CONFIG_SPI_FLASH_SPANSION enabled in > configs/socfpga_arria5_dbrrh_defconfig (dbrrh - is my custom board). > > Actually, today I solved the problem, although in not very clean way, I think. > > As I mentioned in previous mail I had problems with reading from the flash. > Some bytes were read incorrectly. > I'm migrating from U-Boot 2013 to mainline U-Boot. And on previous version > there were no such issue. > I found out that there was some workaround introduced in order to fix this. > > So, I just apply some part of that workaround to mainline U-Boot and now it > works. > > Here is the problem in more detail: > > On previous version (2013): > U-BOOT # sf read 0x1B00 0x0380 4 > cadence_qspi_apb_indirect_read_setup. addr_value = 0x380 > cadence_qspi_apb_indirect_read_setup. rd_reg = 0x80b > cadence_qspi_apb_indirect_read_setup. device size = 0x101003 > > U-BOOT # md 0x1B00 1 > 1b00: 55424923 > > But on mainline U-Boot(2016.03-rc1) I had: > U-BOOT # sf read 0x1B00 0x0380 4 > cadence_qspi_apb_indirect_read_setup. addr_value = 0x80 > cadence_qspi_apb_indirect_read_setup. rd_reg = 0x0b > cadence_qspi_apb_indirect_read_setup. device size = 0x101002 > > U-BOOT # md 0x1B00 1 > 1b00: 554249ff > > You can see the difference in the register values that were written in QSPI > registers. > In case with mainline U-Boot I had address value not properly set. > > Here is the workaround that I've made: > > Index: drivers/mtd/spi/spi_flash.c > === > --- drivers/mtd/spi/spi_flash.c (revision 608) > +++ drivers/mtd/spi/spi_flash.c (revision 609) > @@ -29,6 +29,17 @@ > cmd[3] = addr >> 0; > } > > +#ifdef CONFIG_DBRRH_WORKAROUND > +static void spi_flash_addr32(u32 addr, u8 *cmd) > +{ > + /* cmd[0] is actual command */ > + cmd[1] = (addr >> 24) & 0xFF; > + cmd[2] = (addr >> 16) & 0xFF; > + cmd[3] = (addr >> 8) & 0xFF; > + cmd[4] = (addr >> 0) & 0xFF; > +} > +#endif > + > static int read_sr(struct spi_flash *flash, u8 *rs) > { > int ret; > @@ -510,8 +521,14 @@ > else > read_len = remain_len; > > +#ifdef CONFIG_DBRRH_WORKAROUND > + spi_flash_addr32(read_addr, cmd); > +#else > spi_flash_addr(read_addr, cmd); > +#endif > > ret = spi_flash_read_common(flash, cmd, cmdsz, data, > read_len); > if (ret < 0) { > debug("SF: read failed\n"); > > Index: drivers/spi/cadence_qspi_apb.c > === > --- drivers/spi/cadence_qspi_apb.c (revision 608) > +++ drivers/spi/cadence_qspi_apb.c (revision 609) > @@ -30,6 +30,10 @@ > #include > #include "cadence_qspi.h" > > +#ifdef CONFIG_DBRRH_WORKAROUND > + #define CMD_OPTION_DUMMY_CYCLES 0x7F/* Dummy Cycles for > Read Command */ > +#endif > + > @@ -706,9 +710,25 @@ > #endif > > /* Get address */ > +#ifdef CONFIG_DBRRH_WORKAROUND > + addr_value = cadence_qspi_apb_cmd2addr(&cmdbuf[1], 4); > +#else > addr_value = cadence_qspi_apb_cmd2addr(&cmdbuf[1], addr_bytes); > +#endif > > +#ifdef CONFIG_DBRRH_WORKAROUND > + /* Setting Dummy Clock Cycle */ > + dummy_clk = (0x08 & CMD_OPTION_DUMMY_CYCLES); > + if (dummy_clk) > + { > + rd_reg |= (dummy_clk & CQSPI_REG_RD_INSTR_DUMMY_MASK) > + << CQSPI_REG_RD_INSTR_DUMMY_LSB; > + } > +#else > + > /* The remaining lenght is dummy bytes. */ > dummy_bytes = cmdlen - addr_bytes - 1; > if (dummy_bytes) { > @@ -731,7 +751,9 @@ > rd_reg |= (dummy_clk & CQSPI_REG_RD_INSTR_DUMMY_MASK) > << CQSPI_REG_RD_INSTR_DUMMY_LSB; > } > +#endif > > > With this correction I can read contents of the flash properly. > However, I'm a bit surprised that I was forced to make such correction like > storing 4 bytes of address (see spi_flash_addr32() above). Instead of 4-byte addressing, u-boot using only 3-byte addressing with BAR support for accessing flash's more
[U-Boot] [PATCH] amcc-common.h: Disable CONFIG_SYS_LONGHELP
There are a number of AMCC platforms which are close to, or with some toolchains exceeding, the size constraints. Disable CONFIG_SYS_LONGHELP to get us room to build with again. Signed-off-by: Tom Rini --- include/configs/amcc-common.h |1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h index 78d8044..60d6be7 100644 --- a/include/configs/amcc-common.h +++ b/include/configs/amcc-common.h @@ -69,7 +69,6 @@ * Miscellaneous configurable options */ #define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */ -#define CONFIG_SYS_LONGHELP/* undef to save memory */ #if defined(CONFIG_CMD_KGDB) #define CONFIG_SYS_CBSIZE 1024/* Console I/O Buffer Size */ #else -- 1.7.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 3/5] spi: omap3: Move headers code inside the driver
Hi Jagan, Please see some feedback below. I got some patch formatting issues. Please see below CR >> Best Regards Christophe -Original Message- From: Jagan Teki [mailto:jt...@openedev.com] Sent: lundi 22 février 2016 13:39 To: u-boot@lists.denx.de Cc: Christophe Henri RICARD; Simon Glass; Tom Rini; Jagan Teki Subject: [PATCH v4 3/5] spi: omap3: Move headers code inside the driver Header file have macro's and register definition and some unneeded function proto types which becomes tunned further in future patches and entire driver code resides in one file for more readability. Cc: Tom Rini Cc: Simon Glass Cc: Christophe Ricard Signed-off-by: Jagan Teki --- drivers/spi/omap3_spi.c | 94 - drivers/spi/omap3_spi.h | 109 2 files changed, 92 insertions(+), 111 deletions(-) delete mode 100644 drivers/spi/omap3_spi.h diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index 95cdfa3..12fa290 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -18,9 +18,99 @@ #include #include #include -#include "omap3_spi.h" -#define SPI_WAIT_TIMEOUT 10 +#if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX) +#define OMAP3_MCSPI1_BASE 0x48030100 +#define OMAP3_MCSPI2_BASE 0x481A0100 +#else +#define OMAP3_MCSPI1_BASE 0x48098000 +#define OMAP3_MCSPI2_BASE 0x4809A000 +#define OMAP3_MCSPI3_BASE 0x480B8000 +#define OMAP3_MCSPI4_BASE 0x480BA000 +#endif + +/* per-register bitmasks */ +#define OMAP3_MCSPI_SYSCONFIG_SMARTIDLE (2 << 3) #define +OMAP3_MCSPI_SYSCONFIG_ENAWAKEUP BIT(2) +#define OMAP3_MCSPI_SYSCONFIG_AUTOIDLE BIT(0) +#define OMAP3_MCSPI_SYSCONFIG_SOFTRESET BIT(1) + +#define OMAP3_MCSPI_SYSSTATUS_RESETDONE BIT(0) + +#define OMAP3_MCSPI_MODULCTRL_SINGLE BIT(0) +#define OMAP3_MCSPI_MODULCTRL_MS BIT(2) +#define OMAP3_MCSPI_MODULCTRL_STESTBIT(3) + +#define OMAP3_MCSPI_CHCONF_PHA BIT(0) +#define OMAP3_MCSPI_CHCONF_POL BIT(1) +#define OMAP3_MCSPI_CHCONF_CLKD_MASK GENMASK(5, 2) +#define OMAP3_MCSPI_CHCONF_EPOLBIT(6) +#define OMAP3_MCSPI_CHCONF_WL_MASK GENMASK(11, 7) +#define OMAP3_MCSPI_CHCONF_TRM_RX_ONLY BIT(12) +#define OMAP3_MCSPI_CHCONF_TRM_TX_ONLY BIT(13) +#define OMAP3_MCSPI_CHCONF_TRM_MASKGENMASK(13, 12) +#define OMAP3_MCSPI_CHCONF_DMAWBIT(14) +#define OMAP3_MCSPI_CHCONF_DMARBIT(15) +#define OMAP3_MCSPI_CHCONF_DPE0BIT(16) +#define OMAP3_MCSPI_CHCONF_DPE1BIT(17) +#define OMAP3_MCSPI_CHCONF_IS BIT(18) +#define OMAP3_MCSPI_CHCONF_TURBO BIT(19) +#define OMAP3_MCSPI_CHCONF_FORCE BIT(20) + +#define OMAP3_MCSPI_CHSTAT_RXS BIT(0) +#define OMAP3_MCSPI_CHSTAT_TXS BIT(1) +#define OMAP3_MCSPI_CHSTAT_EOT BIT(2) + +#define OMAP3_MCSPI_CHCTRL_EN BIT(0) +#define OMAP3_MCSPI_CHCTRL_DIS (0 << 0) + +#define OMAP3_MCSPI_WAKEUPENABLE_WKEN BIT(0) + +#define OMAP3_MCSPI_MAX_FREQ 4800 +#define SPI_WAIT_TIMEOUT 10 + +/* OMAP3 McSPI registers */ +struct mcspi_channel { + unsigned int chconf;/* 0x2C, 0x40, 0x54, 0x68 */ + unsigned int chstat;/* 0x30, 0x44, 0x58, 0x6C */ + unsigned int chctrl;/* 0x34, 0x48, 0x5C, 0x70 */ + unsigned int tx;/* 0x38, 0x4C, 0x60, 0x74 */ + unsigned int rx;/* 0x3C, 0x50, 0x64, 0x78 */ +}; + +struct mcspi { + unsigned char res1[0x10]; + unsigned int sysconfig; /* 0x10 */ + unsigned int sysstatus; /* 0x14 */ + unsigned int irqstatus; /* 0x18 */ + unsigned int irqenable; /* 0x1C */ + unsigned int wakeupenable; /* 0x20 */ + unsigned int syst; /* 0x24 */ + unsigned int modulctrl; /* 0x28 */ + struct mcspi_channel channel[4]; /* channel0: 0x2C - 0x3C, bus 0 & 1 & 2 & 3 */ + /* channel1: 0x40 - 0x50, bus 0 & 1 */ + /* channel2: 0x54 - 0x64, bus 0 & 1 */ + /* channel3: 0x68 - 0x78, bus 0 */ }; + +struct omap3_spi_slave { + struct spi_slave slave; + struct mcspi *regs; + unsigned int freq; + unsigned int mode; +}; + +static inline struct omap3_spi_slave *to_omap3_spi(struct spi_slave +*slave) { + return container_of(slave, struct omap3_spi_slave, slave); } + +int omap3_spi_txrx(struct spi_slave *slave, unsigned int len, const void *txp, + void *rxp, unsigned long flags); +int omap3_spi_write(struct spi_slave *slave, unsigned int len, const void *txp, + unsigned long flags); +int omap3_spi_read(struct spi_slave *slave, unsigned int len, void *rxp, + unsigned long flags); static void spi_reset(struct omap3_spi_slave *ds) { diff --git a/drivers/s
Re: [U-Boot] [PATCH v4 0/5] dm: omap3_spi: Convert to driver model
Hi Jagan, Apologies for the delay, i got busy on other non u-boot topic. I have been reviewing and tried to applied your patches but it seems patches 3/4/5 got some formatting issues (due to mailbox client may be ?). I think I should be able to test this work anyway. Do you want me to send back the whole serie I have tested as a ack and tested by ? I will answer back on each patch where I got the issue. Best Regards Christophe -Original Message- From: Jagan Teki [mailto:jt...@openedev.com] Sent: lundi 29 février 2016 13:45 To: u-boot@lists.denx.de Cc: Christophe Henri RICARD; Simon Glass; Tom Rini; Jagan Teki Subject: Re: [PATCH v4 0/5] dm: omap3_spi: Convert to driver model Christophe/All, On 22 February 2016 at 18:11, Jagan Teki wrote: > Christophe, > > Please test this series if you have hw. > > On 22 February 2016 at 18:09, Jagan Teki wrote: >> Changes for v4: >> - rebase to master >> Changes for v3: >> - Add DECLARE_GLOBAL_DATA_PTR Changes for v2: >> - Added dm pindir-d0-out-d1-in logic >> - Updated comment about 4-wire master mode as per Linux. >> >> Christophe Ricard (2): >> spi: omap3: Remove unused variable irqstatus in omap3_spi_txrx >> spi: spi-uclass: Set slave wordlen with SPI_DEFAULT_WORDLEN >> >> Jagan Teki (3): >> spi: omap3: Move headers code inside the driver >> spi: omap3: Make local functions as static >> spi: omap3: Convert to driver model Can any one test these 3 patches? thanks! -- Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 5/5] spi: omap3: Convert to driver model
Hi Jagan, I like your work but i think there is some few formatting issue on the patch itself. Please see below CR >> Best Regards Christophe -Original Message- From: Jagan Teki [mailto:jt...@openedev.com] Sent: lundi 22 février 2016 13:39 To: u-boot@lists.denx.de Cc: Christophe Henri RICARD; Simon Glass; Tom Rini; Jagan Teki Subject: [PATCH v4 5/5] spi: omap3: Convert to driver model After this conversion the driver will able to support both dm and non-dm and code is more extensible like we can remove the non-dm part simply without touching anycode if all the boards which are using this driver become dm driven. CR >> over 80 characters ? Cc: Tom Rini Reviewed-by: Simon Glass Acked-by: Christophe Ricard Signed-off-by: Jagan Teki --- drivers/spi/omap3_spi.c | 686 +--- 1 file changed, 415 insertions(+), 271 deletions(-) diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index 8b0f665..11f8b12 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -1,4 +1,6 @@ /* + * Copyright (C) 2016 Jagan Teki + * * Copyright (C) 2010 Dirk Behme * * Driver for McSPI controller on OMAP3. Based on davinci_spi.c @@ -15,10 +17,13 @@ */ #include +#include #include #include #include +DECLARE_GLOBAL_DATA_PTR; + #if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX) #define OMAP3_MCSPI1_BASE 0x48030100 #define OMAP3_MCSPI2_BASE 0x481A0100 @@ -65,6 +70,8 @@ #define OMAP3_MCSPI_CHCTRL_DIS (0 << 0) #define OMAP3_MCSPI_WAKEUPENABLE_WKEN BIT(0) +#define MCSPI_PINDIR_D0_IN_D1_OUT 0 +#define MCSPI_PINDIR_D0_OUT_D1_IN 1 #define OMAP3_MCSPI_MAX_FREQ 4800 #define SPI_WAIT_TIMEOUT 10 @@ -93,312 +100,123 @@ struct mcspi { /* channel3: 0x68 - 0x78, bus 0 */ }; -struct omap3_spi_slave { - struct spi_slave slave; +struct omap3_spi_priv { struct mcspi *regs; + unsigned int cs; unsigned int freq; unsigned int mode; + unsigned int wordlen; + unsigned int pin_dir:1; }; -static inline struct omap3_spi_slave *to_omap3_spi(struct spi_slave *slave) -{ - return container_of(slave, struct omap3_spi_slave, slave); -} - -static void spi_reset(struct omap3_spi_slave *ds) -{ - unsigned int tmp; - - writel(OMAP3_MCSPI_SYSCONFIG_SOFTRESET, &ds->regs->sysconfig); - do { - tmp = readl(&ds->regs->sysstatus); - } while (!(tmp & OMAP3_MCSPI_SYSSTATUS_RESETDONE)); - - writel(OMAP3_MCSPI_SYSCONFIG_AUTOIDLE | -OMAP3_MCSPI_SYSCONFIG_ENAWAKEUP | -OMAP3_MCSPI_SYSCONFIG_SMARTIDLE, -&ds->regs->sysconfig); - - writel(OMAP3_MCSPI_WAKEUPENABLE_WKEN, &ds->regs->wakeupenable); -} - -static void omap3_spi_write_chconf(struct omap3_spi_slave *ds, int val) +static void omap3_spi_write_chconf(struct omap3_spi_priv *priv, int +val) { - writel(val, &ds->regs->channel[ds->slave.cs].chconf); + writel(val, &priv->regs->channel[priv->cs].chconf); /* Flash post writes to make immediate effect */ - readl(&ds->regs->channel[ds->slave.cs].chconf); + readl(&priv->regs->channel[priv->cs].chconf); } -static void omap3_spi_set_enable(struct omap3_spi_slave *ds, int enable) +static void omap3_spi_set_enable(struct omap3_spi_priv *priv, int +enable) { - writel(enable, &ds->regs->channel[ds->slave.cs].chctrl); + writel(enable, &priv->regs->channel[priv->cs].chctrl); /* Flash post writes to make immediate effect */ - readl(&ds->regs->channel[ds->slave.cs].chctrl); -} - -void spi_init() -{ - /* do nothing */ + readl(&priv->regs->channel[priv->cs].chctrl); } -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct omap3_spi_slave *ds; - struct mcspi *regs; - - /* -* OMAP3 McSPI (MultiChannel SPI) has 4 busses (modules) -* with different number of chip selects (CS, channels): -* McSPI1 has 4 CS (bus 0, cs 0 - 3) -* McSPI2 has 2 CS (bus 1, cs 0 - 1) -* McSPI3 has 2 CS (bus 2, cs 0 - 1) -* McSPI4 has 1 CS (bus 3, cs 0) -*/ - - switch (bus) { - case 0: - regs = (struct mcspi *)OMAP3_MCSPI1_BASE; - break; -#ifdef OMAP3_MCSPI2_BASE - case 1: - regs = (struct mcspi *)OMAP3_MCSPI2_BASE; - break; -#endif -#ifdef OMAP3_MCSPI3_BASE - case 2: - regs = (struct mcspi *)OMAP3_MCSPI3_BASE; - break; -#endif -#ifdef OMAP3_MCSPI4_BASE - case 3: - regs = (struct mcspi *)OMAP3_MCSPI4_BASE; - break; -#endif - default: - printf("SPI error: unsupported bus %i. \ - Supported busses
Re: [U-Boot] [PATCH 02/10] arm64: Make full va map code more dynamic
On 29.02.16 17:52, Stephen Warren wrote: > On 02/27/2016 05:09 AM, Alexander Graf wrote: >> >> >> On 26.02.16 20:25, Stephen Warren wrote: >>> On 02/25/2016 09:36 AM, Alexander Graf wrote: On 24.02.16 19:14, Stephen Warren wrote: > On 02/24/2016 05:11 AM, Alexander Graf wrote: >> The idea to generate our pages tables from an array of memory ranges >> is very sound. However, instead of hard coding the code to create up >> to 2 levels of 64k granule page tables, we really should just create >> normal 4k page tables that allow us to set caching attributes on 2M >> or 4k level later on. >> >> So this patch moves the full_va mapping code to 4k page size and >> makes it fully flexible to dynamically create as many levels as >> necessary for a map (including dynamic 1G/2M pages). It also adds >> support to dynamically split a large map into smaller ones when >> some code wants to set dcache attributes. >> >> With all this in place, there is very little reason to create your >> own page tables in board specific files. >> >> Signed-off-by: Alexander Graf > >> +/* >> + * This is a recursively called function to count the number of >> + * page tables we need to cover a particular PTE range. If you >> + * call this with level = -1 you basically get the full 48 bit >> + * coverage. >> + */ >> +static int count_required_pts(u64 addr, int level, u64 maxaddr) > > I think this looks correct now. Nits below if a respin is needed for > other reasons. > >> +{ >> +int levelshift = level2shift(level); >> +u64 levelsize = 1ULL << levelshift; >> +u64 levelmask = levelsize - 1; >> +u64 levelend = addr + levelsize; >> +int r = 0; >> +int i; >> +bool is_level = false; > > I might suggest renaming that is_level_needed. It's not obvious to me > exactly what the name "is_level" is intended to represent; the name > seems to represent whether something (unspecified) is a level or not. We're basically asking the function whether a PTE for address at level would be an inval/block/level PTE. is_level marks it as a level pte. I could maybe rename this into pte_type and create an enum that is either PTE_INVAL, PTE_BLOCK or PTE_LEVEL. > >> + >> +for (i = 0; i < ARRAY_SIZE(mem_map); i++) { >> +struct mm_region *map = &mem_map[i]; >> +u64 start = map->base; >> +u64 end = start + map->size; >> + >> +/* Check if the PTE would overlap with the map */ >> +if (max(addr, start) <= min(levelend, end)) { >> +start = max(addr, start); >> +end = min(levelend, end); >> + >> +/* We need a sub-pt for this level */ >> +if ((start & levelmask) || (end & levelmask)) { >> +is_level = true; >> +break; >> +} >> + >> +/* Lv0 can not do block PTEs, so do levels here too */ >> +if (level <= 0) { >> +is_level = true; >> +break; >> +} >> +} >> +} >> + >> +/* >> + * Block PTEs at this level are already covered by the parent >> page >> + * table, so we only need to count sub page tables. >> + */ >> +if (is_level) { >> +int sublevel = level + 1; >> +u64 sublevelsize = 1ULL << level2shift(sublevel); >> + >> +/* Account for the new sub page table ... */ >> +r = 1; > > "Account for the page table at /this/ level"? This may represent the > top-level (0/1) page table, not just sub page tables. The sub-level > accounting is via the recursive call to count_required_pts() I > believe. I think the easiest way to visualize what's going on is if we start with level -1. We basically ask the function at level -1 whether a PTE at level -1 (48 bits) would fit into a block PTE at level -1 (so the PTE spans all 48 bits) or whether we need to create a new level entry plus page table for it. >>> >>> Hmm, I had overlooked that the call to count_required_pts() passed >>> "start_level - 1" not "start_level". Now that I see that, your >>> explanation makes more sense to me. >>> >>> It'd be nice if some/all of this explanation were comments in the code >>> to aid readers. >>> >>> That said, I would have expected a slightly more direct calculation; why >>> not: >>> >>> int start_level = 0; // or 1 if small VA space >>> total_pts = count_required_pts(start_level); >> >> We need to account for the count twice, to have an (immutable) copy of >> our page tables around when we split them. > > I think that's just a hard-coded "* 2" there, unless I'm missing your > point? Yes :). >
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
I won't be able to fix it tonight, but I'll try to look at this tomorrow. Sorry, I was in a hurry this morning. Does anyone have an opinion on whether or not I should I also remove the 'const' part of the declaration? I wonder how much longer we'll be using this mechanism before the device trees take over. It seems like only a handful of omap boards use it. adam On Mon, Feb 29, 2016 at 7:04 AM, Alexander Graf wrote: > On 02/29/2016 12:53 PM, Adam Ford wrote: >> >> V2: I hastily copy-pasted the boards without looking at the UART number. >> This addresses 3 boards that use UART3 and not UART1. >> >> With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset >> property" >> reg_offset is added to the struct ns16550_platdata to be >> dt compatible with Linux kernel driver. A variety of OMAP3 boards are >> broken >> as the serial platdata is missing offsets. By explicitly naming the entry, >> this should also help 'future-proof' if more entries get added but are not >> needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. >> >> I only changed a handful of devices that used the same syntax as the Logic >> board. Appologies if I missed one or stepped on toes. Thanks to Derald >> Woods >> and Alexander Graf. >> >> Signed-off-by: Adam Ford >> --- >> board/isee/igep00x0/igep00x0.c | 7 --- >> board/logicpd/omap3som/omap3logic.c | 7 --- >> board/logicpd/zoom1/zoom1.c | 7 --- >> board/overo/overo.c | 7 --- >> board/quipos/cairo/cairo.c | 7 --- >> board/ti/beagle/beagle.c| 7 --- >> board/timll/devkit8000/devkit8000.c | 7 --- >> 7 files changed, 28 insertions(+), 21 deletions(-) >> >> diff --git a/board/isee/igep00x0/igep00x0.c >> b/board/isee/igep00x0/igep00x0.c >> index e2fce50..63489e5 100644 >> --- a/board/isee/igep00x0/igep00x0.c >> +++ b/board/isee/igep00x0/igep00x0.c >> @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { >> #endif >> static const struct ns16550_platdata igep_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, > > > This looks wrong > >> + .reg_offset = 0, > > > I'd say just leave reg_offset out in all the structs. It gets initialized to > 0 by default. > > > >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> U_BOOT_DEVICE(igep_uart) = { >> diff --git a/board/logicpd/omap3som/omap3logic.c >> b/board/logicpd/omap3som/omap3logic.c >> index 668f684..0e72a5a 100644 >> --- a/board/logicpd/omap3som/omap3logic.c >> +++ b/board/logicpd/omap3som/omap3logic.c >> @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; >>*/ >> static const struct ns16550_platdata omap3logic_serial = { >> - OMAP34XX_UART1, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> U_BOOT_DEVICE(omap3logic_uart) = { >> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c >> index 4040114..3d34919 100644 >> --- a/board/logicpd/zoom1/zoom1.c >> +++ b/board/logicpd/zoom1/zoom1.c >> @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { >> }; >> static const struct ns16550_platdata zoom1_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, > > > looks wrong too > > >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> U_BOOT_DEVICE(zoom1_uart) = { >> diff --git a/board/overo/overo.c b/board/overo/overo.c >> index a38b959..3da80e9 100644 >> --- a/board/overo/overo.c >> +++ b/board/overo/overo.c >> @@ -68,9 +68,10 @@ static struct { >> } expansion_config = {0x0}; >> static const struct ns16550_platdata overo_serial = { >> - OMAP34XX_UART3, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART3, >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> U_BOOT_DEVICE(overo_uart) = { >> diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c >> index 21793e8..15d68c1 100644 >> --- a/board/quipos/cairo/cairo.c >> +++ b/board/quipos/cairo/cairo.c >> @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings >> *timings) >> #endif >> static const struct ns16550_platdata cairo_serial = { >> - OMAP34XX_UART2, >> - 2, >> - V_NS16550_CLK >> + .base = OMAP34XX_UART1, > > > wrong? > > Given the number of typos, maybe try and create a coccinelle script instead? > :) > > > Alex > > >> + .reg_offset = 0, >> + .reg_shift = 2, >> + .clock = V_NS16550_CLK >> }; >> U_BOOT_DEVICE(cairo_uart) = { >> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c >> index ff317ef..a5f2af7 100644 >> --- a/board/ti/beagle/beagle.c >> +++ b/board/ti/beagle/beagle.c >> @@ -73,9 +73,10 @@ static struct { >> } expansion_config; >> st
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
On Mon, Feb 29, 2016 at 03:31:35PM -0600, Adam Ford wrote: > I won't be able to fix it tonight, but I'll try to look at this > tomorrow. Sorry, I was in a hurry this morning. Does anyone have an > opinion on whether or not I should I also remove the 'const' part of > the declaration? I wonder how much longer we'll be using this > mechanism before the device trees take over. It seems like only a > handful of omap boards use it. > The commit was reverted this morning. There is no need for a patch now. U-Boot 'master' has been updated. - Derald > adam > > On Mon, Feb 29, 2016 at 7:04 AM, Alexander Graf wrote: > > On 02/29/2016 12:53 PM, Adam Ford wrote: > >> > >> V2: I hastily copy-pasted the boards without looking at the UART number. > >> This addresses 3 boards that use UART3 and not UART1. > >> > >> With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset > >> property" > >> reg_offset is added to the struct ns16550_platdata to be > >> dt compatible with Linux kernel driver. A variety of OMAP3 boards are > >> broken > >> as the serial platdata is missing offsets. By explicitly naming the entry, > >> this should also help 'future-proof' if more entries get added but are not > >> needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. > >> > >> I only changed a handful of devices that used the same syntax as the Logic > >> board. Appologies if I missed one or stepped on toes. Thanks to Derald > >> Woods > >> and Alexander Graf. > >> > >> Signed-off-by: Adam Ford > >> --- > >> board/isee/igep00x0/igep00x0.c | 7 --- > >> board/logicpd/omap3som/omap3logic.c | 7 --- > >> board/logicpd/zoom1/zoom1.c | 7 --- > >> board/overo/overo.c | 7 --- > >> board/quipos/cairo/cairo.c | 7 --- > >> board/ti/beagle/beagle.c| 7 --- > >> board/timll/devkit8000/devkit8000.c | 7 --- > >> 7 files changed, 28 insertions(+), 21 deletions(-) > >> > >> diff --git a/board/isee/igep00x0/igep00x0.c > >> b/board/isee/igep00x0/igep00x0.c > >> index e2fce50..63489e5 100644 > >> --- a/board/isee/igep00x0/igep00x0.c > >> +++ b/board/isee/igep00x0/igep00x0.c > >> @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { > >> #endif > >> static const struct ns16550_platdata igep_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > This looks wrong > > > >> + .reg_offset = 0, > > > > > > I'd say just leave reg_offset out in all the structs. It gets initialized to > > 0 by default. > > > > > > > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(igep_uart) = { > >> diff --git a/board/logicpd/omap3som/omap3logic.c > >> b/board/logicpd/omap3som/omap3logic.c > >> index 668f684..0e72a5a 100644 > >> --- a/board/logicpd/omap3som/omap3logic.c > >> +++ b/board/logicpd/omap3som/omap3logic.c > >> @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; > >>*/ > >> static const struct ns16550_platdata omap3logic_serial = { > >> - OMAP34XX_UART1, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(omap3logic_uart) = { > >> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c > >> index 4040114..3d34919 100644 > >> --- a/board/logicpd/zoom1/zoom1.c > >> +++ b/board/logicpd/zoom1/zoom1.c > >> @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { > >> }; > >> static const struct ns16550_platdata zoom1_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > looks wrong too > > > > > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(zoom1_uart) = { > >> diff --git a/board/overo/overo.c b/board/overo/overo.c > >> index a38b959..3da80e9 100644 > >> --- a/board/overo/overo.c > >> +++ b/board/overo/overo.c > >> @@ -68,9 +68,10 @@ static struct { > >> } expansion_config = {0x0}; > >> static const struct ns16550_platdata overo_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART3, > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(overo_uart) = { > >> diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c > >> index 21793e8..15d68c1 100644 > >> --- a/board/quipos/cairo/cairo.c > >> +++ b/board/quipos/cairo/cairo.c > >> @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings > >> *timings) > >> #endif > >> static const struct ns16550_platdata cairo_serial = { > >> - OMAP34XX_UART2, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > wrong? > > > > Given the number
Re: [U-Boot] [PATCH V2] OMAP3: Various: Update serial platdata to update reg_offset to 0
On Mon, Feb 29, 2016 at 03:31:35PM -0600, Adam Ford wrote: > I won't be able to fix it tonight, but I'll try to look at this > tomorrow. Sorry, I was in a hurry this morning. Does anyone have an > opinion on whether or not I should I also remove the 'const' part of > the declaration? I wonder how much longer we'll be using this > mechanism before the device trees take over. It seems like only a > handful of omap boards use it. So, for the moment, no rush. I reverted the dm commit for this release. > > adam > > On Mon, Feb 29, 2016 at 7:04 AM, Alexander Graf wrote: > > On 02/29/2016 12:53 PM, Adam Ford wrote: > >> > >> V2: I hastily copy-pasted the boards without looking at the UART number. > >> This addresses 3 boards that use UART3 and not UART1. > >> > >> With commit: d9a3bec682f9 "dm: ns16550: Add support for reg-offset > >> property" > >> reg_offset is added to the struct ns16550_platdata to be > >> dt compatible with Linux kernel driver. A variety of OMAP3 boards are > >> broken > >> as the serial platdata is missing offsets. By explicitly naming the entry, > >> this should also help 'future-proof' if more entries get added but are not > >> needed for OMAP3. Tested on the Logic PD Torpedo + Wireless. > >> > >> I only changed a handful of devices that used the same syntax as the Logic > >> board. Appologies if I missed one or stepped on toes. Thanks to Derald > >> Woods > >> and Alexander Graf. > >> > >> Signed-off-by: Adam Ford > >> --- > >> board/isee/igep00x0/igep00x0.c | 7 --- > >> board/logicpd/omap3som/omap3logic.c | 7 --- > >> board/logicpd/zoom1/zoom1.c | 7 --- > >> board/overo/overo.c | 7 --- > >> board/quipos/cairo/cairo.c | 7 --- > >> board/ti/beagle/beagle.c| 7 --- > >> board/timll/devkit8000/devkit8000.c | 7 --- > >> 7 files changed, 28 insertions(+), 21 deletions(-) > >> > >> diff --git a/board/isee/igep00x0/igep00x0.c > >> b/board/isee/igep00x0/igep00x0.c > >> index e2fce50..63489e5 100644 > >> --- a/board/isee/igep00x0/igep00x0.c > >> +++ b/board/isee/igep00x0/igep00x0.c > >> @@ -34,9 +34,10 @@ static const u32 gpmc_lan_config[] = { > >> #endif > >> static const struct ns16550_platdata igep_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > This looks wrong > > > >> + .reg_offset = 0, > > > > > > I'd say just leave reg_offset out in all the structs. It gets initialized to > > 0 by default. > > > > > > > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(igep_uart) = { > >> diff --git a/board/logicpd/omap3som/omap3logic.c > >> b/board/logicpd/omap3som/omap3logic.c > >> index 668f684..0e72a5a 100644 > >> --- a/board/logicpd/omap3som/omap3logic.c > >> +++ b/board/logicpd/omap3som/omap3logic.c > >> @@ -47,9 +47,10 @@ DECLARE_GLOBAL_DATA_PTR; > >>*/ > >> static const struct ns16550_platdata omap3logic_serial = { > >> - OMAP34XX_UART1, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(omap3logic_uart) = { > >> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c > >> index 4040114..3d34919 100644 > >> --- a/board/logicpd/zoom1/zoom1.c > >> +++ b/board/logicpd/zoom1/zoom1.c > >> @@ -44,9 +44,10 @@ static const u32 gpmc_lab_enet[] = { > >> }; > >> static const struct ns16550_platdata zoom1_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > looks wrong too > > > > > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(zoom1_uart) = { > >> diff --git a/board/overo/overo.c b/board/overo/overo.c > >> index a38b959..3da80e9 100644 > >> --- a/board/overo/overo.c > >> +++ b/board/overo/overo.c > >> @@ -68,9 +68,10 @@ static struct { > >> } expansion_config = {0x0}; > >> static const struct ns16550_platdata overo_serial = { > >> - OMAP34XX_UART3, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART3, > >> + .reg_offset = 0, > >> + .reg_shift = 2, > >> + .clock = V_NS16550_CLK > >> }; > >> U_BOOT_DEVICE(overo_uart) = { > >> diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c > >> index 21793e8..15d68c1 100644 > >> --- a/board/quipos/cairo/cairo.c > >> +++ b/board/quipos/cairo/cairo.c > >> @@ -91,9 +91,10 @@ void get_board_mem_timings(struct board_sdrc_timings > >> *timings) > >> #endif > >> static const struct ns16550_platdata cairo_serial = { > >> - OMAP34XX_UART2, > >> - 2, > >> - V_NS16550_CLK > >> + .base = OMAP34XX_UART1, > > > > > > wrong? > > > > Given the number of typos, maybe try and create a coccinell
[U-Boot] [PATCH v2 02/32] dm: pci: Break out the common region display code
Each region is displayed in almost the same way. Break out this common code into its own function. Signed-off-by: Simon Glass --- Changes in v2: - Fix use of pci_mem instead of pci_prefetch - Remove 0x prefix for addresses drivers/pci/pci_auto_common.c | 51 +++ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c index 85c419e..677f094 100644 --- a/drivers/pci/pci_auto_common.c +++ b/drivers/pci/pci_auto_common.c @@ -62,6 +62,17 @@ int pciauto_region_allocate(struct pci_region *res, pci_size_t size, return -1; } +static void pciauto_show_region(const char *name, struct pci_region *region) +{ + pciauto_region_init(region); + debug("PCI Autoconfig: Bus %s region: [%llx-%llx],\n" + "\t\tPhysical Memory [%llx-%llxx]\n", name, + (unsigned long long)region->bus_start, + (unsigned long long)(region->bus_start + region->size - 1), + (unsigned long long)region->phys_start, + (unsigned long long)(region->phys_start + region->size - 1)); +} + void pciauto_config_init(struct pci_controller *hose) { int i; @@ -91,38 +102,10 @@ void pciauto_config_init(struct pci_controller *hose) } - if (hose->pci_mem) { - pciauto_region_init(hose->pci_mem); - - debug("PCI Autoconfig: Bus Memory region: [0x%llx-0x%llx],\n" - "\t\tPhysical Memory [%llx-%llxx]\n", - (u64)hose->pci_mem->bus_start, - (u64)(hose->pci_mem->bus_start + hose->pci_mem->size - 1), - (u64)hose->pci_mem->phys_start, - (u64)(hose->pci_mem->phys_start + hose->pci_mem->size - 1)); - } - - if (hose->pci_prefetch) { - pciauto_region_init(hose->pci_prefetch); - - debug("PCI Autoconfig: Bus Prefetchable Mem: [0x%llx-0x%llx],\n" - "\t\tPhysical Memory [%llx-%llx]\n", - (u64)hose->pci_prefetch->bus_start, - (u64)(hose->pci_prefetch->bus_start + - hose->pci_prefetch->size - 1), - (u64)hose->pci_prefetch->phys_start, - (u64)(hose->pci_prefetch->phys_start + - hose->pci_prefetch->size - 1)); - } - - if (hose->pci_io) { - pciauto_region_init(hose->pci_io); - - debug("PCI Autoconfig: Bus I/O region: [0x%llx-0x%llx],\n" - "\t\tPhysical Memory: [%llx-%llx]\n", - (u64)hose->pci_io->bus_start, - (u64)(hose->pci_io->bus_start + hose->pci_io->size - 1), - (u64)hose->pci_io->phys_start, - (u64)(hose->pci_io->phys_start + hose->pci_io->size - 1)); - } + if (hose->pci_mem) + pciauto_show_region("Memory", hose->pci_mem); + if (hose->pci_prefetch) + pciauto_show_region("Prefetchable Mem", hose->pci_prefetch); + if (hose->pci_io) + pciauto_show_region("I/O", hose->pci_io); } -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 01/32] dm: Drop the block_dev_desc_t typedef
Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long and causes 80-column violations, rename it to struct blk_desc. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None api/api.c | 2 +- api/api_storage.c | 14 ++--- board/cm5200/fwupdate.c| 2 +- board/mpl/pip405/README| 4 +- cmd/disk.c | 2 +- cmd/fat.c | 4 +- cmd/gpt.c | 8 +-- cmd/host.c | 4 +- cmd/ide.c | 22 cmd/mmc.c | 2 +- cmd/part.c | 8 +-- cmd/read.c | 4 +- cmd/reiser.c | 4 +- cmd/sata.c | 10 ++-- cmd/scsi.c | 12 ++--- cmd/unzip.c| 2 +- cmd/usb.c | 2 +- cmd/usb_mass_storage.c | 6 +-- cmd/zfs.c | 4 +- common/env_fat.c | 4 +- common/fb_mmc.c| 12 ++--- common/spl/spl_ext.c | 6 +-- common/spl/spl_fat.c | 8 +-- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 22 disk/part.c| 28 +- disk/part_amiga.c | 14 ++--- disk/part_dos.c| 19 +++ disk/part_efi.c| 38 ++--- disk/part_iso.c| 10 ++-- disk/part_mac.c| 19 --- drivers/block/dwc_ahsata.c | 4 +- drivers/block/sandbox.c| 12 ++--- drivers/block/systemace.c | 8 +-- drivers/dfu/dfu_mmc.c | 2 +- drivers/mmc/mmc.c | 4 +- drivers/mmc/mmc_private.h | 8 +-- drivers/mmc/mmc_write.c| 4 +- fs/ext4/dev.c | 53 +- fs/ext4/ext4fs.c | 2 +- fs/fat/fat.c | 6 +-- fs/fs.c| 6 +-- fs/reiserfs/dev.c | 33 +--- fs/sandbox/sandboxfs.c | 4 +- fs/ubifs/ubifs.c | 2 +- fs/zfs/dev.c | 35 ++-- fs/zfs/zfs.c | 2 +- include/common.h | 2 +- include/ext4fs.h | 6 +-- include/fat.h | 4 +- include/ide.h | 6 +-- include/mmc.h | 2 +- include/part.h | 130 - include/reiserfs.h | 2 +- include/sandboxblockdev.h | 2 +- include/sandboxfs.h| 2 +- include/sata.h | 2 +- include/spl.h | 10 ++-- include/systemace.h| 2 +- include/ubifs_uboot.h | 2 +- include/usb.h | 2 +- include/usb_mass_storage.h | 2 +- include/zfs_common.h | 4 +- lib/gunzip.c | 2 +- test/dm/usb.c | 2 +- 66 files changed, 338 insertions(+), 331 deletions(-) diff --git a/api/api.c b/api/api.c index c5f6edb..830d6fb 100644 --- a/api/api.c +++ b/api/api.c @@ -189,7 +189,7 @@ static int API_get_timer(va_list ap) * * - net: ð_device struct address from list pointed to by eth_devices * - * - storage: block_dev_desc_t struct address from &ide_dev_desc[n], + * - storage: struct blk_desc struct address from &ide_dev_desc[n], * &scsi_dev_desc[n] and similar tables * / diff --git a/api/api_storage.c b/api/api_storage.c index bc2b4d6..225a6cf 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -103,7 +103,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) int i; - block_dev_desc_t *dd; + struct blk_desc *dd; if (first) { di->cookie = (void *)get_dev(specs[type].name, 0); @@ -148,7 +148,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) di->type = specs[type].type; if (di->cookie != NULL) { - dd = (block_dev_desc_t *)di->cookie; + dd = (struct blk_desc *)di->cookie; if (dd->type == DEV_TYPE_UNKNOWN) { debugf("device instance exists, but is not active.."); found = 0; @@ -166,9 +166,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) /* - * returns:ENUM_IDE, ENUM_USB etc. based on block_dev_desc_t + * returns:ENUM_IDE, ENUM_USB etc. based on struct blk_desc */ -static int dev_stor_type(block_dev_desc_t *dd) +static int dev_stor_type(struct blk_desc *dd) { int i, j; @@ -308,7 +308,7 @@ int dev_enum_storage(struct device_info *di) return 0; } -static int dev_stor_is_valid(int type, block_dev_desc_t *dd) +static int dev_stor_is_valid(int type, struct blk_desc *dd) { int i; @@ -328,7 +328,7 @@ int dev_open_stor(void *cookie) if (type == ENUM_MAX) return API_ENODEV; - if
[U-Boot] [PATCH v2 05/32] dm: part: Drop the common.h header
We should not include in header files. Each C file should include it if needed. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None include/part.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/part.h b/include/part.h index d1e9d0f..140c9b6 100644 --- a/include/part.h +++ b/include/part.h @@ -8,7 +8,6 @@ #define _PART_H #include -#include struct blk_desc { int if_type;/* type of the interface */ -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 03/32] dm: part: Correct a sandbox build warning
Adjust the cast to avoid a warning when stdint.h is used. Signed-off-by: Simon Glass --- Changes in v2: None disk/part_efi.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index db5e7ed..7bd840f 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -658,11 +658,13 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, gpt_part_size = le64_to_cpu(gpt_e[i].ending_lba) - le64_to_cpu(gpt_e[i].starting_lba) + 1; debug("size(LBA) - GPT: %8llu, ENV: %8llu ", - gpt_part_size, (u64) partitions[i].size); + (unsigned long long)gpt_part_size, + (unsigned long long)partitions[i].size); if (le64_to_cpu(gpt_part_size) != partitions[i].size) { error("Partition %s size: %llu does not match %llu!\n", - efi_str, gpt_part_size, (u64) partitions[i].size); + efi_str, (unsigned long long)gpt_part_size, + (unsigned long long)partitions[i].size); return -1; } @@ -678,12 +680,12 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, /* Check if GPT and ENV start LBAs match */ debug("start LBA - GPT: %8llu, ENV: %8llu\n", le64_to_cpu(gpt_e[i].starting_lba), - (u64) partitions[i].start); + (unsigned long long)partitions[i].start); if (le64_to_cpu(gpt_e[i].starting_lba) != partitions[i].start) { error("Partition %s start: %llu does not match %llu!\n", efi_str, le64_to_cpu(gpt_e[i].starting_lba), - (u64) partitions[i].start); + (unsigned long long)partitions[i].start); return -1; } } -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 07/32] dm: blk: Convert interface type to an enum
Since these are sequentially numbered it makes sense to use an enum. It avoids having to maintain the maximum value, and provides a type we can use if it is useful. In fact the maximum value is not used. Rename it to COUNT, since MAX suggests it is the maximum valid value, but it is not. Signed-off-by: Simon Glass --- Changes in v2: - Add a missing word 'is' to the commit message - Rename the enum to 'if_type' instead of 'if_type_t' include/blk.h | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/include/blk.h b/include/blk.h index 1e8334c..fd54520 100644 --- a/include/blk.h +++ b/include/blk.h @@ -19,20 +19,23 @@ typedef ulong lbaint_t; #define LBAFU "%" LBAFlength "u" /* Interface types: */ -#define IF_TYPE_UNKNOWN0 -#define IF_TYPE_IDE1 -#define IF_TYPE_SCSI 2 -#define IF_TYPE_ATAPI 3 -#define IF_TYPE_USB4 -#define IF_TYPE_DOC5 -#define IF_TYPE_MMC6 -#define IF_TYPE_SD 7 -#define IF_TYPE_SATA 8 -#define IF_TYPE_HOST 9 -#define IF_TYPE_MAX10 /* Max number of IF_TYPE_* supported */ +enum if_type { + IF_TYPE_UNKNOWN = 0, + IF_TYPE_IDE, + IF_TYPE_SCSI, + IF_TYPE_ATAPI, + IF_TYPE_USB, + IF_TYPE_DOC, + IF_TYPE_MMC, + IF_TYPE_SD, + IF_TYPE_SATA, + IF_TYPE_HOST, + + IF_TYPE_COUNT, /* Number of interface types */ +}; struct blk_desc { - int if_type;/* type of the interface */ + enum if_typeif_type;/* type of the interface */ int dev;/* device number */ unsigned char part_type; /* partition type */ unsigned char target; /* target SCSI ID */ -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 09/32] dm: blk: Rename get_dev() to blk_get_dev()
The current name is too generic. Add a 'blk_' prefix to aid searching and make its purpose clearer. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None api/api_storage.c | 12 +++- cmd/gpt.c | 2 +- cmd/read.c| 2 +- common/fb_mmc.c | 4 ++-- disk/part.c | 4 ++-- include/part.h| 6 +++--- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/api/api_storage.c b/api/api_storage.c index 225a6cf..8c30c56 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -106,7 +106,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) struct blk_desc *dd; if (first) { - di->cookie = (void *)get_dev(specs[type].name, 0); + di->cookie = (void *)blk_get_dev(specs[type].name, 0); if (di->cookie == NULL) return 0; else @@ -119,7 +119,8 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) } else { for (i = 0; i < specs[type].max_dev; i++) - if (di->cookie == (void *)get_dev(specs[type].name, i)) { + if (di->cookie == + (void *)blk_get_dev(specs[type].name, i)) { /* previous cookie found -- advance to the * next device, if possible */ @@ -129,7 +130,8 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di) break; } - di->cookie = (void *)get_dev(specs[type].name, i); + di->cookie = (void *)blk_get_dev( + specs[type].name, i); if (di->cookie == NULL) return 0; else @@ -174,7 +176,7 @@ static int dev_stor_type(struct blk_desc *dd) for (i = ENUM_IDE; i < ENUM_MAX; i++) for (j = 0; j < specs[i].max_dev; j++) - if (dd == get_dev(specs[i].name, j)) + if (dd == blk_get_dev(specs[i].name, j)) return i; return ENUM_MAX; @@ -313,7 +315,7 @@ static int dev_stor_is_valid(int type, struct blk_desc *dd) int i; for (i = 0; i < specs[type].max_dev; i++) - if (dd == get_dev(specs[type].name, i)) + if (dd == blk_get_dev(specs[type].name, i)) if (dd->type != DEV_TYPE_UNKNOWN) return 1; diff --git a/cmd/gpt.c b/cmd/gpt.c index 881367c..8ffaef3 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -418,7 +418,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("'%s' is not a number\n", argv[3]); return CMD_RET_USAGE; } - blk_dev_desc = get_dev(argv[2], dev); + blk_dev_desc = blk_get_dev(argv[2], dev); if (!blk_dev_desc) { printf("%s: %s dev %d NOT available\n", __func__, argv[2], dev); diff --git a/cmd/read.c b/cmd/read.c index 6a1e1d9..12ac1659 100644 --- a/cmd/read.c +++ b/cmd/read.c @@ -39,7 +39,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) part = (int)simple_strtoul(++ep, NULL, 16); } - dev_desc = get_dev(argv[1], dev); + dev_desc = blk_get_dev(argv[1], dev); if (dev_desc == NULL) { printf("Block device %s %d not supported\n", argv[1], dev); return 1; diff --git a/common/fb_mmc.c b/common/fb_mmc.c index fd43085..4324f58 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -106,7 +106,7 @@ void fb_mmc_flash_write(const char *cmd, unsigned int session_id, /* initialize the response buffer */ response_str = response; - dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); + dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { error("invalid mmc device\n"); fastboot_fail(response_str, "invalid mmc device"); @@ -179,7 +179,7 @@ void fb_mmc_erase(const char *cmd, char *response) /* initialize the response buffer */ response_str = response; - dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); + dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) { error("invalid mmc device"); fastboot_fail(response_str, "invalid mmc device"); diff --git a/disk/part.c b/disk/part.c index 7f98d89..2466c3e 100644 --- a/disk/part.c +++ b/disk/part.c @@ -101,7 +101,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev,
[U-Boot] [PATCH v2 04/32] dm: fdtdec: Correct a sandbox build warning
Adjust the cast to avoid a warning when stdint.h is used. Signed-off-by: Simon Glass --- Changes in v2: None lib/fdtdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index b361a25..0cb255f 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -123,9 +123,10 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node, if (sizep) { *sizep = fdtdec_get_number(prop_size, ns); - debug("addr=%08llx, size=%llx\n", (u64)addr, (u64)*sizep); + debug("addr=%08llx, size=%llx\n", (unsigned long long)addr, + (unsigned long long)*sizep); } else { - debug("addr=%08llx\n", (u64)addr); + debug("addr=%08llx\n", (unsigned long long)addr); } return addr; -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 06/32] dm: Add a new header for block devices
At present block devices are tied up with partitions. But not all block devices have partitions within them. They are in fact separate concepts. Create a separate blk.h header file for block devices. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None include/blk.h | 71 ++ include/ide.h | 12 ++ include/part.h | 49 +--- 3 files changed, 74 insertions(+), 58 deletions(-) create mode 100644 include/blk.h diff --git a/include/blk.h b/include/blk.h new file mode 100644 index 000..1e8334c --- /dev/null +++ b/include/blk.h @@ -0,0 +1,71 @@ +/* + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef BLK_H +#define BLK_H + +#ifdef CONFIG_SYS_64BIT_LBA +typedef uint64_t lbaint_t; +#define LBAFlength "ll" +#else +typedef ulong lbaint_t; +#define LBAFlength "l" +#endif +#define LBAF "%" LBAFlength "x" +#define LBAFU "%" LBAFlength "u" + +/* Interface types: */ +#define IF_TYPE_UNKNOWN0 +#define IF_TYPE_IDE1 +#define IF_TYPE_SCSI 2 +#define IF_TYPE_ATAPI 3 +#define IF_TYPE_USB4 +#define IF_TYPE_DOC5 +#define IF_TYPE_MMC6 +#define IF_TYPE_SD 7 +#define IF_TYPE_SATA 8 +#define IF_TYPE_HOST 9 +#define IF_TYPE_MAX10 /* Max number of IF_TYPE_* supported */ + +struct blk_desc { + int if_type;/* type of the interface */ + int dev;/* device number */ + unsigned char part_type; /* partition type */ + unsigned char target; /* target SCSI ID */ + unsigned char lun;/* target LUN */ + unsigned char hwpart; /* HW partition, e.g. for eMMC */ + unsigned char type; /* device type */ + unsigned char removable; /* removable device */ +#ifdef CONFIG_LBA48 + /* device can use 48bit addr (ATA/ATAPI v7) */ + unsigned char lba48; +#endif + lbaint_tlba;/* number of blocks */ + unsigned long blksz; /* block size */ + int log2blksz; /* for convenience: log2(blksz) */ + charvendor[40+1]; /* IDE model, SCSI Vendor */ + charproduct[20+1]; /* IDE Serial no, SCSI product */ + charrevision[8+1]; /* firmware revision */ + unsigned long (*block_read)(struct blk_desc *block_dev, + lbaint_t start, + lbaint_t blkcnt, + void *buffer); + unsigned long (*block_write)(struct blk_desc *block_dev, + lbaint_t start, + lbaint_t blkcnt, + const void *buffer); + unsigned long (*block_erase)(struct blk_desc *block_dev, + lbaint_t start, + lbaint_t blkcnt); + void*priv; /* driver private struct pointer */ +}; + +#define BLOCK_CNT(size, blk_desc) (PAD_COUNT(size, blk_desc->blksz)) +#define PAD_TO_BLOCKSIZE(size, blk_desc) \ + (PAD_SIZE(size, blk_desc->blksz)) + +#endif diff --git a/include/ide.h b/include/ide.h index 2407393..a4e65cf 100644 --- a/include/ide.h +++ b/include/ide.h @@ -8,6 +8,8 @@ #ifndef_IDE_H #define _IDE_H +#include + #define IDE_BUS(dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS)) #defineATA_CURR_BASE(dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)]) @@ -26,16 +28,6 @@ extern ulong ide_bus_offset[]; void ide_led(uchar led, uchar status); #endif /* CONFIG_IDE_LED */ -#ifdef CONFIG_SYS_64BIT_LBA -typedef uint64_t lbaint_t; -#define LBAFlength "ll" -#else -typedef ulong lbaint_t; -#define LBAFlength "l" -#endif -#define LBAF "%" LBAFlength "x" -#define LBAFU "%" LBAFlength "u" - /* * Function Prototypes */ diff --git a/include/part.h b/include/part.h index 140c9b6..258 100644 --- a/include/part.h +++ b/include/part.h @@ -7,61 +7,14 @@ #ifndef _PART_H #define _PART_H +#include #include -struct blk_desc { - int if_type;/* type of the interface */ - int dev;/* device number */ - unsigned char part_type; /* partition type */ - unsigned char target; /* target SCSI ID */ - unsigned char lun;/* target LUN */ - unsigned char hwpart; /* HW partition, e.g. for eMMC */ - unsigned char type; /* device type */ - unsigned char removable; /* removable device */ -#ifdef CONFIG_LBA48 - unsigned char lba48; /* device can use 48bit addr (ATA
[U-Boot] [PATCH v2 11/32] dm: blk: Rename get_device_and_partition()
Rename this function to blk_get_device_part_str(). This is a better name because it makes it clear that the function returns a block device and parses a string. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Rename to blk_get_device_by_str() cmd/disk.c | 2 +- cmd/fat.c| 4 ++-- cmd/part.c | 2 +- cmd/reiser.c | 4 ++-- cmd/zfs.c| 4 ++-- common/env_fat.c | 4 ++-- disk/part.c | 2 +- fs/fs.c | 2 +- fs/ubifs/ubifs.c | 2 +- include/part.h | 42 ++ 10 files changed, 51 insertions(+), 17 deletions(-) diff --git a/cmd/disk.c b/cmd/disk.c index c53c2a2..0883c79 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -38,7 +38,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE); - part = get_device_and_partition(intf, (argc == 3) ? argv[2] : NULL, + part = blk_get_device_part_str(intf, (argc == 3) ? argv[2] : NULL, &dev_desc, &info, 1); if (part < 0) { bootstage_error(BOOTSTAGE_ID_IDE_TYPE); diff --git a/cmd/fat.c b/cmd/fat.c index 82b9b38..18a1be9 100644 --- a/cmd/fat.c +++ b/cmd/fat.c @@ -77,7 +77,7 @@ static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; @@ -114,7 +114,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag, if (argc < 5) return cmd_usage(cmdtp); - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; diff --git a/cmd/part.c b/cmd/part.c index dd32d50..415b38a 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -37,7 +37,7 @@ static int do_part_uuid(int argc, char * const argv[]) if (argc > 3) return CMD_RET_USAGE; - part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0); + part = blk_get_device_part_str(argv[0], argv[1], &dev_desc, &info, 0); if (part < 0) return 1; diff --git a/cmd/reiser.c b/cmd/reiser.c index 1cca5eb..a717956 100644 --- a/cmd/reiser.c +++ b/cmd/reiser.c @@ -40,7 +40,7 @@ int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 3) return CMD_RET_USAGE; - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; @@ -122,7 +122,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; diff --git a/cmd/zfs.c b/cmd/zfs.c index 9076a8a..bb61afd 100644 --- a/cmd/zfs.c +++ b/cmd/zfs.c @@ -80,7 +80,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] return 1; } - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; @@ -145,7 +145,7 @@ static int do_zfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc == 4) filename = argv[3]; - part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1); + part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); if (part < 0) return 1; diff --git a/common/env_fat.c b/common/env_fat.c index e88279e..2f22710 100644 --- a/common/env_fat.c +++ b/common/env_fat.c @@ -48,7 +48,7 @@ int saveenv(void) if (err) return err; - part = get_device_and_partition(FAT_ENV_INTERFACE, + part = blk_get_device_part_str(FAT_ENV_INTERFACE, FAT_ENV_DEVICE_AND_PART, &dev_desc, &info, 1); if (part < 0) @@ -82,7 +82,7 @@ void env_relocate_spec(void) int dev, part; int err; - part = get_device_and_partition(FAT_ENV_INTERFACE, + part = blk_get_device_part_str(FAT_ENV_INTERFACE, FAT_ENV_DEVICE_AND_PART, &dev_desc, &info, 1); if (part < 0) diff --git a/disk/part.c b/disk/part.c index 2e7adbc..255ee79 100644 --- a/disk/part.c +++ b/disk/part.c @@ -511,7 +511,7 @@ cleanup: #define PART
[U-Boot] [PATCH v2 08/32] dm: blk: Add comments to a few functions
The block interface is not well documented in the code. Pick two important functions and add comments. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None include/part.h | 30 ++ 1 file changed, 30 insertions(+) diff --git a/include/part.h b/include/part.h index 258..4e70d8d 100644 --- a/include/part.h +++ b/include/part.h @@ -53,12 +53,42 @@ typedef struct disk_partition { /* Misc _get_dev functions */ #ifdef CONFIG_PARTITIONS +/** + * get_dev() - get a pointer to a block device given its type and number + * + * Each interface allocates its own devices and typically struct blk_desc is + * contained with the interface's data structure. There is no global + * numbering for block devices, so the interface name must be provided. + * + * @ifname:Interface name (e.g. "ide", "scsi") + * @dev: Device number (0 for first device on that interface, 1 for + * second, etc. + * @return pointer to the block device, or NULL if not available, or an + *error occurred. + */ struct blk_desc *get_dev(const char *ifname, int dev); struct blk_desc *ide_get_dev(int dev); struct blk_desc *sata_get_dev(int dev); struct blk_desc *scsi_get_dev(int dev); struct blk_desc *usb_stor_get_dev(int dev); struct blk_desc *mmc_get_dev(int dev); + +/** + * mmc_select_hwpart() - Select the MMC hardware partiion on an MMC device + * + * MMC devices can support partitioning at the hardware level. This is quite + * separate from the normal idea of software-based partitions. MMC hardware + * partitions must be explicitly selected. Once selected only the region of + * the device covered by that partition is accessible. + * + * The MMC standard provides for two boot partitions (numbered 1 and 2), + * rpmb (3), and up to 4 addition general-purpose partitions (4-7). + * + * @dev_num: Block device number (struct blk_desc->dev value) + * @hwpart:Hardware partition number to select. 0 means the raw device, + * 1 is the first partition, 2 is the second, etc. + * @return 0 if OK, other value for an error + */ int mmc_select_hwpart(int dev_num, int hwpart); struct blk_desc *systemace_get_dev(int dev); struct blk_desc *mg_disk_get_dev(int dev); -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 12/32] dm: part: Add a cast to avoid a compiler warning
In part_amiga.c the name is unsigned but bcpl_strcpy() requires a signed pointer. Add a cast to fix the warning. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Fix 'by' which should be 'but' in the commit message disk/part_amiga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/part_amiga.c b/disk/part_amiga.c index 008941c..5702c95 100644 --- a/disk/part_amiga.c +++ b/disk/part_amiga.c @@ -304,7 +304,7 @@ int get_partition_info_amiga(struct blk_desc *dev_desc, int part, info->start = g->low_cyl * g->block_per_track * g->surfaces; info->size = (g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1; info->blksz = rdb.block_bytes; -bcpl_strcpy(info->name, p->drive_name); +bcpl_strcpy((char *)info->name, p->drive_name); disk_type = g->dos_type; -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 14/32] dm: part: Convert partition API use to linker lists
We can use linker lists instead of explicitly declaring each function. This makes the code shorter by avoiding switch() statements and lots of header file declarations. While this does clean up the code it introduces a few code issues with SPL. SPL never needs to print partition information since this all happens from commands. SPL mostly doesn't need to obtain information about a partition either, except in a few cases. Add these cases so that the code will be dropped from each partition driver when not needed. This avoids code bloat. I think this is still a win, since it is not a bad thing to be explicit about which features are used in SPL. But others may like to weigh in. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- Changes in v2: - Reorder the linker list so that EFI comes before DOS, and add a comment disk/part.c | 184 +- disk/part_amiga.c | 16 +++-- disk/part_dos.c | 9 ++- disk/part_efi.c | 15 - disk/part_iso.c | 16 +++-- disk/part_mac.c | 16 +++-- include/part.h| 79 ++- 7 files changed, 162 insertions(+), 173 deletions(-) diff --git a/disk/part.c b/disk/part.c index 255ee79..978b85c 100644 --- a/disk/part.c +++ b/disk/part.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -58,6 +59,22 @@ static const struct block_drvr block_drvr[] = { DECLARE_GLOBAL_DATA_PTR; #ifdef HAVE_BLOCK_DEVICE +static struct part_driver *part_driver_lookup_type(int part_type) +{ + struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); + struct part_driver *entry; + + for (entry = drv; entry != drv + n_ents; entry++) { + if (part_type == entry->part_type) + return entry; + } + + /* Not found */ + return NULL; +} + static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) { const struct block_drvr *drvr = block_drvr; @@ -252,53 +269,31 @@ void dev_print (struct blk_desc *dev_desc) void init_part(struct blk_desc *dev_desc) { -#ifdef CONFIG_ISO_PARTITION - if (test_part_iso(dev_desc) == 0) { - dev_desc->part_type = PART_TYPE_ISO; - return; - } -#endif + struct part_driver *drv = + ll_entry_start(struct part_driver, part_driver); + const int n_ents = ll_entry_count(struct part_driver, part_driver); + struct part_driver *entry; -#ifdef CONFIG_MAC_PARTITION - if (test_part_mac(dev_desc) == 0) { - dev_desc->part_type = PART_TYPE_MAC; - return; - } -#endif - -/* must be placed before DOS partition detection */ -#ifdef CONFIG_EFI_PARTITION - if (test_part_efi(dev_desc) == 0) { - dev_desc->part_type = PART_TYPE_EFI; - return; - } -#endif - -#ifdef CONFIG_DOS_PARTITION - if (test_part_dos(dev_desc) == 0) { - dev_desc->part_type = PART_TYPE_DOS; - return; - } -#endif - -#ifdef CONFIG_AMIGA_PARTITION - if (test_part_amiga(dev_desc) == 0) { - dev_desc->part_type = PART_TYPE_AMIGA; - return; - } -#endif dev_desc->part_type = PART_TYPE_UNKNOWN; + for (entry = drv; entry != drv + n_ents; entry++) { + int ret; + + ret = entry->test(dev_desc); + debug("%s: try '%s': ret=%d\n", __func__, entry->name, ret); + if (!ret) { + dev_desc->part_type = entry->part_type; + break; + } + } } - +static void print_part_header(const char *type, struct blk_desc *dev_desc) +{ #if defined(CONFIG_MAC_PARTITION) || \ defined(CONFIG_DOS_PARTITION) || \ defined(CONFIG_ISO_PARTITION) || \ defined(CONFIG_AMIGA_PARTITION) || \ defined(CONFIG_EFI_PARTITION) - -static void print_part_header(const char *type, struct blk_desc *dev_desc) -{ puts ("\nPartition Map for "); switch (dev_desc->if_type) { case IF_TYPE_IDE: @@ -331,54 +326,24 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) } printf (" device %d -- Partition Type: %s\n\n", dev_desc->dev, type); -} - #endif /* any CONFIG_..._PARTITION */ +} void print_part(struct blk_desc *dev_desc) { + struct part_driver *drv; - switch (dev_desc->part_type) { -#ifdef CONFIG_MAC_PARTITION - case PART_TYPE_MAC: - PRINTF ("## Testing for valid MAC partition ##\n"); - print_part_header ("MAC", dev_desc); - print_part_mac (dev_desc); - return; -#endif -#ifdef CONFIG_DOS_PARTITION - case PART_TYPE_DOS: - PRINTF ("## Testing for valid DOS partition ##\n"); -
[U-Boot] [PATCH v2 10/32] dm: blk: Rename get_device() to blk_get_device_by_str()
The current name is too generic. The function returns a block device based on a provided string. Rename it to aid searching and make its purpose clearer. Also add a few comments. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Rename to blk_get_device_by_str() cmd/part.c | 6 +++--- cmd/unzip.c| 2 +- cmd/usb_mass_storage.c | 2 +- disk/part.c| 6 +++--- include/part.h | 34 ++ test/dm/usb.c | 2 +- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/cmd/part.c b/cmd/part.c index a572aab..dd32d50 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -81,7 +81,7 @@ static int do_part_list(int argc, char * const argv[]) return CMD_RET_USAGE; } - ret = get_device(argv[0], argv[1], &desc); + ret = blk_get_device_by_str(argv[0], argv[1], &desc); if (ret < 0) return 1; @@ -128,7 +128,7 @@ static int do_part_start(int argc, char * const argv[]) part = simple_strtoul(argv[2], NULL, 0); - ret = get_device(argv[0], argv[1], &desc); + ret = blk_get_device_by_str(argv[0], argv[1], &desc); if (ret < 0) return 1; @@ -162,7 +162,7 @@ static int do_part_size(int argc, char * const argv[]) part = simple_strtoul(argv[2], NULL, 0); - ret = get_device(argv[0], argv[1], &desc); + ret = blk_get_device_by_str(argv[0], argv[1], &desc); if (ret < 0) return 1; diff --git a/cmd/unzip.c b/cmd/unzip.c index 5be1566..a8bcb1f 100644 --- a/cmd/unzip.c +++ b/cmd/unzip.c @@ -53,7 +53,7 @@ static int do_gzwrite(cmd_tbl_t *cmdtp, int flag, if (argc < 5) return CMD_RET_USAGE; - ret = get_device(argv[1], argv[2], &bdev); + ret = blk_get_device_by_str(argv[1], argv[2], &bdev); if (ret < 0) return CMD_RET_FAILURE; diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index 03b7e21..59bb4ee 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -69,7 +69,7 @@ static int ums_init(const char *devtype, const char *devnums) if (!devnum) break; - ret = get_device(devtype, devnum, &block_dev); + ret = blk_get_device_by_str(devtype, devnum, &block_dev); if (ret < 0) goto cleanup; diff --git a/disk/part.c b/disk/part.c index 2466c3e..2e7adbc 100644 --- a/disk/part.c +++ b/disk/part.c @@ -449,8 +449,8 @@ int get_partition_info(struct blk_desc *dev_desc, int part, return -1; } -int get_device(const char *ifname, const char *dev_hwpart_str, - struct blk_desc **dev_desc) +int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str, + struct blk_desc **dev_desc) { char *ep; char *dup_str = NULL; @@ -598,7 +598,7 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str, } /* Look up the device */ - dev = get_device(ifname, dev_str, dev_desc); + dev = blk_get_device_by_str(ifname, dev_str, dev_desc); if (dev < 0) goto cleanup; diff --git a/include/part.h b/include/part.h index ddc4422..6ca87d0 100644 --- a/include/part.h +++ b/include/part.h @@ -101,8 +101,34 @@ int get_partition_info(struct blk_desc *dev_desc, int part, void print_part(struct blk_desc *dev_desc); void init_part(struct blk_desc *dev_desc); void dev_print(struct blk_desc *dev_desc); -int get_device(const char *ifname, const char *dev_str, - struct blk_desc **dev_desc); + +/** + * blk_get_device_by_str() - Get a block device given its interface/hw partition + * + * Each interface allocates its own devices and typically struct blk_desc is + * contained with the interface's data structure. There is no global + * numbering for block devices, so the interface name must be provided. + * + * The hardware parition is not related to the normal software partitioning + * of a device - each hardware partition is effectively a separately + * accessible block device. When a hardware parition is selected on MMC the + * other hardware partitions become inaccessible. The same block device is + * used to access all hardware partitions, but its capacity may change when a + * different hardware partition is selected. + * + * When a hardware partition number is given, the block device switches to + * that hardware partition. + * + * @ifname:Interface name (e.g. "ide", "scsi") + * @dev_str: Device and optional hw partition. This can either be a string + * containing the device number (e.g. "2") or the device number + * and hardware partition number (e.g. "2.4") for devices that + * support it (currently only MMC). + * @dev_desc: Returns a pointer to the block device on success + * @return block device number (local to the inte
[U-Boot] [PATCH v2 21/32] dm: usb: Tidy up storage code ready for driver model conversion
Adjust a few things so that the addition of driver-models support involved adding code rather than also changing it. This makes the patches easier to review. Signed-off-by: Simon Glass --- Changes in v2: None common/usb_storage.c | 117 +++ 1 file changed, 61 insertions(+), 56 deletions(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index f2d2ad9..0475123 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -142,6 +142,7 @@ static void usb_show_progress(void) */ int usb_stor_info(void) { + int count = 0; int i; if (usb_max_devs > 0) { @@ -152,7 +153,11 @@ int usb_stor_info(void) return 0; } - printf("No storage devices, perhaps not 'usb start'ed..?\n"); + if (!count) { + printf("No storage devices, perhaps not 'usb start'ed..?\n"); + return 1; + } + return 1; } @@ -171,9 +176,12 @@ static unsigned int usb_get_max_lun(struct us_data *us) return (len > 0) ? *result : 0; } -static int usb_stor_probe_device(struct usb_device *dev) +static int usb_stor_probe_device(struct usb_device *udev) { - if (dev == NULL) + int lun, max_lun; + int start; + + if (udev == NULL) return -ENOENT; /* no more devices available */ /* We don't have space to even probe if we hit the maximum */ @@ -184,36 +192,36 @@ static int usb_stor_probe_device(struct usb_device *dev) } debug("\n\nProbing for storage\n"); - if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) { - /* OK, it's a storage device. Iterate over its LUNs - * and populate `usb_dev_desc'. - */ - int lun, max_lun, start = usb_max_devs; - - max_lun = usb_get_max_lun(&usb_stor[usb_max_devs]); - for (lun = 0; - lun <= max_lun && usb_max_devs < USB_MAX_STOR_DEV; - lun++) { - struct blk_desc *blkdev; - - blkdev = &usb_dev_desc[usb_max_devs]; - memset(blkdev, '\0', sizeof(struct blk_desc)); - blkdev->if_type = IF_TYPE_USB; - blkdev->devnum = usb_max_devs; - blkdev->part_type = PART_TYPE_UNKNOWN; - blkdev->target = 0xff; - blkdev->type = DEV_TYPE_UNKNOWN; - blkdev->block_read = usb_stor_read; - blkdev->block_write = usb_stor_write; - blkdev->lun = lun; - blkdev->priv = dev; - - if (usb_stor_get_info(dev, &usb_stor[start], - &usb_dev_desc[usb_max_devs]) == - 1) { - usb_max_devs++; - debug("%s: Found device %p\n", __func__, dev); - } + if (!usb_storage_probe(udev, 0, &usb_stor[usb_max_devs])) + return 0; + + /* +* OK, it's a storage device. Iterate over its LUNs and populate +* usb_dev_desc' +*/ + start = usb_max_devs; + + max_lun = usb_get_max_lun(&usb_stor[usb_max_devs]); + for (lun = 0; lun <= max_lun && usb_max_devs < USB_MAX_STOR_DEV; +lun++) { + struct blk_desc *blkdev; + + blkdev = &usb_dev_desc[usb_max_devs]; + memset(blkdev, '\0', sizeof(struct blk_desc)); + blkdev->if_type = IF_TYPE_USB; + blkdev->devnum = usb_max_devs; + blkdev->part_type = PART_TYPE_UNKNOWN; + blkdev->target = 0xff; + blkdev->type = DEV_TYPE_UNKNOWN; + blkdev->block_read = usb_stor_read; + blkdev->block_write = usb_stor_write; + blkdev->lun = lun; + blkdev->priv = udev; + + if (usb_stor_get_info(udev, &usb_stor[start], + &usb_dev_desc[usb_max_devs]) == 1) { + usb_max_devs++; + debug("%s: Found device %p\n", __func__, udev); } } @@ -1029,36 +1037,33 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor, static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) { - int device = block_dev->devnum; lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks; - struct usb_device *dev; + struct usb_device *udev; struct us_data *ss; int retry; ccb *srb = &usb_ccb; if (blkcnt == 0) return 0; - - device &= 0xff; /* Setup device */ - debug("\nusb_read: dev %d\n", devic
[U-Boot] [PATCH v2 13/32] dm: sandbox: Enable all partition types
It is useful to have sandbox build as much code as possible to avoid having to build every board to detect build errors. Also we may add tests for some more partition types at some point. Enable all partition types in sandbox. Signed-off-by: Simon Glass Reviewed-by: Tom Rini Reviewed-by: Bin Meng --- Changes in v2: - Sort the CONFIG_..._PARTITION options in the header file include/configs/sandbox.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 4bffd8d..786bb11 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -53,8 +53,11 @@ #define CONFIG_CMD_GPT #define CONFIG_PARTITION_UUIDS -#define CONFIG_EFI_PARTITION +#define CONFIG_AMIGA_PARTITION #define CONFIG_DOS_PARTITION +#define CONFIG_EFI_PARTITION +#define CONFIG_ISO_PARTITION +#define CONFIG_MAC_PARTITION /* * Size of malloc() pool, before and after relocation -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 15/32] dm: part: Rename some partition functions
Rename three partition functions so that they start with part_. This makes it clear what they relate to. Signed-off-by: Simon Glass --- Changes in v2: None board/cm5200/fwupdate.c | 2 +- cmd/ide.c | 6 +++--- cmd/mmc.c | 2 +- cmd/part.c| 8 cmd/read.c| 2 +- cmd/sata.c| 6 +++--- cmd/scsi.c| 6 +++--- cmd/usb.c | 4 ++-- common/fb_mmc.c | 10 +- common/spl/spl_ext.c | 6 ++ common/spl/spl_mmc.c | 2 +- common/usb_storage.c | 2 +- disk/part.c | 12 ++-- disk/part_amiga.c | 4 ++-- disk/part_dos.c | 19 +-- disk/part_efi.c | 10 +- disk/part_iso.c | 17 + disk/part_mac.c | 4 ++-- drivers/block/pata_bfin.c | 2 +- drivers/block/sandbox.c | 2 +- drivers/block/systemace.c | 2 +- drivers/dfu/dfu_mmc.c | 2 +- drivers/mmc/mmc.c | 2 +- fs/fat/fat.c | 2 +- include/part.h| 21 ++--- 25 files changed, 76 insertions(+), 79 deletions(-) diff --git a/board/cm5200/fwupdate.c b/board/cm5200/fwupdate.c index d5064c1..2ed90de 100644 --- a/board/cm5200/fwupdate.c +++ b/board/cm5200/fwupdate.c @@ -117,7 +117,7 @@ static int load_rescue_image(ulong addr) /* Detect partition */ for (partno = -1, i = 0; i < 6; i++) { - if (get_partition_info(stor_dev, i, &info) == 0) { + if (part_get_info(stor_dev, i, &info) == 0) { if (fat_register_device(stor_dev, i) == 0) { /* Check if rescue image is present */ FW_DEBUG("Looking for firmware directory '%s'" diff --git a/cmd/ide.c b/cmd/ide.c index 06202c5..01b91b5 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -137,7 +137,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) ++ok; if (dev) putc('\n'); - print_part(&ide_dev_desc[dev]); + part_print(&ide_dev_desc[dev]); } } if (!ok) { @@ -171,7 +171,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) int dev = (int) simple_strtoul(argv[2], NULL, 10); if (ide_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) { - print_part(&ide_dev_desc[dev]); + part_print(&ide_dev_desc[dev]); } else { printf("\nIDE device %d not available\n", dev); @@ -435,7 +435,7 @@ void ide_init(void) if ((ide_dev_desc[i].lba > 0) && (ide_dev_desc[i].blksz > 0)) { /* initialize partition type */ - init_part(&ide_dev_desc[i]); + part_init(&ide_dev_desc[i]); if (curr_device < 0) curr_device = i; } diff --git a/cmd/mmc.c b/cmd/mmc.c index ab59e7f..fb4382e 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -433,7 +433,7 @@ static int do_mmc_part(cmd_tbl_t *cmdtp, int flag, mmc_dev = mmc_get_dev(curr_device); if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) { - print_part(mmc_dev); + part_print(mmc_dev); return CMD_RET_SUCCESS; } diff --git a/cmd/part.c b/cmd/part.c index 415b38a..414031e 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -92,7 +92,7 @@ static int do_part_list(int argc, char * const argv[]) for (p = 1; p < 128; p++) { char t[5]; - int r = get_partition_info(desc, p, &info); + int r = part_get_info(desc, p, &info); if (r != 0) continue; @@ -107,7 +107,7 @@ static int do_part_list(int argc, char * const argv[]) return 0; } - print_part(desc); + part_print(desc); return 0; } @@ -132,7 +132,7 @@ static int do_part_start(int argc, char * const argv[]) if (ret < 0) return 1; - err = get_partition_info(desc, part, &info); + err = part_get_info(desc, part, &info); if (err) return 1; @@ -166,7 +166,7 @@ static int do_part_size(int argc, char * const argv[]) if (ret < 0) return 1; - err = get_partition_info(desc, part, &info); + err = part_get_info(desc, part, &info); if (err) return 1; diff --git a/cmd/read.c b/cmd/read.c index 12ac1659..f8d
[U-Boot] [PATCH v2 16/32] dm: cbfs: Fix handling of invalid type
The comment for file_cbfs_type() says that it returns 0 for an invalid type. The code appears to check for -1, except that it uses an unsigned variable to store the type. This results in a warning on 64-bit machines. Adjust it to make the meaning clearer. Continue to handle the -1 case since it may be needed. Signed-off-by: Simon Glass --- Changes in v2: - Bring the 'case 0' from a later patch into this one cmd/cbfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/cbfs.c b/cmd/cbfs.c index 35d8a7a..779e9c0 100644 --- a/cmd/cbfs.c +++ b/cmd/cbfs.c @@ -103,7 +103,7 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) printf(" size type name\n"); printf("--\n"); while (file) { - u32 type = file_cbfs_type(file); + int type = file_cbfs_type(file); char *type_name = NULL; const char *filename = file_cbfs_name(file); @@ -140,7 +140,8 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) case CBFS_COMPONENT_CMOS_LAYOUT: type_name = "cmos layout"; break; - case -1UL: + case -1: + case 0: type_name = "null"; break; } -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 31/32] part: Rename test_part_xx() and print_part_xx()
Rename these functions so that part_ is at the start. This more clearly identifies these functions as partition functions. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to rename test_part_xx() and print_part_xx() disk/part_amiga.c | 22 +++--- disk/part_dos.c | 8 disk/part_efi.c | 8 disk/part_iso.c | 8 disk/part_mac.c | 8 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/disk/part_amiga.c b/disk/part_amiga.c index 4a67689..d4316b8 100644 --- a/disk/part_amiga.c +++ b/disk/part_amiga.c @@ -207,27 +207,27 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc) * Test if the given partition has an Amiga partition table/Rigid * Disk block */ -static int test_part_amiga(struct blk_desc *dev_desc) +static int part_test_amiga(struct blk_desc *dev_desc) { struct rigid_disk_block *rdb; struct bootcode_block *bootcode; -PRINTF("test_part_amiga: Testing for an Amiga RDB partition\n"); +PRINTF("part_test_amiga: Testing for an Amiga RDB partition\n"); rdb = get_rdisk(dev_desc); if (rdb) { bootcode = get_bootcode(dev_desc); if (bootcode) - PRINTF("test_part_amiga: bootable Amiga disk\n"); + PRINTF("part_test_amiga: bootable Amiga disk\n"); else - PRINTF("test_part_amiga: non-bootable Amiga disk\n"); + PRINTF("part_test_amiga: non-bootable Amiga disk\n"); return 0; } else { - PRINTF("test_part_amiga: no RDB found\n"); + PRINTF("part_test_amiga: no RDB found\n"); return -1; } @@ -318,7 +318,7 @@ static int part_get_info_amiga(struct blk_desc *dev_desc, int part, return 0; } -static void print_part_amiga(struct blk_desc *dev_desc) +static void part_print_amiga(struct blk_desc *dev_desc) { struct rigid_disk_block *rdb; struct bootcode_block *boot; @@ -329,14 +329,14 @@ static void print_part_amiga(struct blk_desc *dev_desc) rdb = get_rdisk(dev_desc); if (!rdb) { - PRINTF("print_part_amiga: no rdb found\n"); + PRINTF("part_print_amiga: no rdb found\n"); return; } -PRINTF("print_part_amiga: Scanning partition list\n"); +PRINTF("part_print_amiga: Scanning partition list\n"); block = rdb->partition_list; -PRINTF("print_part_amiga: partition list at 0x%x\n", block); +PRINTF("part_print_amiga: partition list at 0x%x\n", block); printf("Summary: DiskBlockSize: %d\n" " Cylinders: %d\n" @@ -382,8 +382,8 @@ U_BOOT_PART_TYPE(amiga) = { .name = "AMIGA", .part_type = PART_TYPE_AMIGA, .get_info = part_get_info_amiga, - .print = print_part_amiga, - .test = test_part_amiga, + .print = part_print_amiga, + .test = part_test_amiga, }; #endif diff --git a/disk/part_dos.c b/disk/part_dos.c index 0ed1374..511917a 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -87,7 +87,7 @@ static int test_block_type(unsigned char *buffer) } -static int test_part_dos(struct blk_desc *dev_desc) +static int part_test_dos(struct blk_desc *dev_desc) { ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); @@ -285,7 +285,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc, return -1; } -void print_part_dos(struct blk_desc *dev_desc) +void part_print_dos(struct blk_desc *dev_desc) { printf("Part\tStart Sector\tNum Sectors\tUUID\t\tType\n"); print_partition_extended(dev_desc, 0, 0, 1, 0); @@ -301,8 +301,8 @@ U_BOOT_PART_TYPE(dos) = { .name = "DOS", .part_type = PART_TYPE_DOS, .get_info = part_get_info_ptr(part_get_info_dos), - .print = part_print_ptr(print_part_dos), - .test = test_part_dos, + .print = part_print_ptr(part_print_dos), + .test = part_test_dos, }; #endif diff --git a/disk/part_efi.c b/disk/part_efi.c index b20907b..77bdfcb 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -176,7 +176,7 @@ static void prepare_backup_gpt_header(gpt_header *gpt_h) * Public Functions (include/part.h) */ -void print_part_efi(struct blk_desc *dev_desc) +void part_print_efi(struct blk_desc *dev_desc) { ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz); gpt_entry *gpt_pte = NULL; @@ -319,7 +319,7 @@ int part_get_info_efi_by_name(struct blk_desc *dev_desc, return -2; } -static int test_part_efi(struct blk_desc *dev_desc) +static int part_test_efi(struct blk_desc *dev_desc) { ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz); @@ -959,7 +959,7 @@ U_BOOT_PART_TYPE(a_efi) = { .name = "EFI", .part_type = PART_TYPE_EFI, .get_info = part_get_info_ptr(part_get_info_efi), -
[U-Boot] [PATCH v2 17/32] dm: sandbox: Enable cbfs and cramfs
Enable these two filesystems to provide better build coverage in sandbox. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None include/configs/sandbox.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 786bb11..f73d040 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -44,6 +44,9 @@ #define CONFIG_CMD_FAT #define CONFIG_CMD_EXT4 #define CONFIG_CMD_EXT4_WRITE +#define CONFIG_CMD_CBFS +#define CONFIG_CMD_CRAMFS +#define CONFIG_CRAMFS_CMDLINE #define CONFIG_CMD_PART #define CONFIG_DOS_PARTITION #define CONFIG_HOST_MAX_DEVICES 4 -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 20/32] dm: usb: Avoid exceeding available array size for storage devices
The limit on storage devices is USB_MAX_STOR_DEV but we use one extra element while probing to see if a device is a storage device. Avoid this, since it causes memory corruption. Signed-off-by: Simon Glass --- Changes in v2: None common/usb_storage.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index 60531e2..f2d2ad9 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -176,6 +176,13 @@ static int usb_stor_probe_device(struct usb_device *dev) if (dev == NULL) return -ENOENT; /* no more devices available */ + /* We don't have space to even probe if we hit the maximum */ + if (usb_max_devs == USB_MAX_STOR_DEV) { + printf("max USB Storage Device reached: %d stopping\n", + usb_max_devs); + return -ENOSPC; + } + debug("\n\nProbing for storage\n"); if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) { /* OK, it's a storage device. Iterate over its LUNs @@ -210,13 +217,6 @@ static int usb_stor_probe_device(struct usb_device *dev) } } - /* if storage device */ - if (usb_max_devs == USB_MAX_STOR_DEV) { - printf("max USB Storage Device reached: %d stopping\n", - usb_max_devs); - return -ENOSPC; - } - return 0; } -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 29/32] dm: usb: Clean up USB after each test
The USB subsystem has a few counters that need to be reset since they are stored in static variables rather than driver-model data. An example is usb_max_devs. Ultimately we should move this data into the USB uclass. For now, make sure that USB is reset after each test, so that the counters go back to zero. Note: this is not a perfect solution: It a USB test fails it will exit immediately and leave USB un-reset. The impact here is that it may cause subsequence test failures in the same run. Signed-off-by: Simon Glass --- Changes in v2: None test/dm/usb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/dm/usb.c b/test/dm/usb.c index 2d20354..b46ae60 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -52,6 +52,7 @@ static int dm_test_usb_flash(struct unit_test_state *uts) memset(cmp, '\0', sizeof(cmp)); ut_asserteq(2, blk_dread(dev_desc, 0, 2, cmp)); ut_assertok(strcmp(cmp, "this is a test")); + ut_assertok(usb_stop()); return 0; } @@ -67,6 +68,7 @@ static int dm_test_usb_multi(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 2, &dev)); + ut_assertok(usb_stop()); return 0; } -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 22/32] dm: blk: Add a block-device uclass
Add a uclass for block devices. These provide block-oriented data access, supporting reading, writing and erasing of whole blocks. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None drivers/block/Kconfig | 11 +++ drivers/block/Makefile | 2 + drivers/block/blk-uclass.c | 175 + include/blk.h | 145 + include/dm/uclass-id.h | 1 + 5 files changed, 334 insertions(+) create mode 100644 drivers/block/blk-uclass.c diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 990f768..f35c4d4 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -1,3 +1,14 @@ +config BLK + bool "Support block devices" + depends on DM + help + Enable support for block devices, such as SCSI, MMC and USB + flash sticks. These provide a block-level interface which permits + reading, writing and (in some cases) erasing blocks. Block + devices often have a partition table which allows the device to + be partitioned into several areas, called 'partitions' in U-Boot. + A filesystem can be placed in each partition. + config DISK bool "Support disk controllers with driver model" depends on DM diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 5eb87e0..b5c7ae1 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -5,6 +5,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_BLK) += blk-uclass.o + obj-$(CONFIG_DISK) += disk-uclass.o obj-$(CONFIG_SCSI_AHCI) += ahci.o obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c new file mode 100644 index 000..49df2a6 --- /dev/null +++ b/drivers/block/blk-uclass.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2016 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#include +#include +#include +#include +#include + +int blk_first_device(int if_type, struct udevice **devp) +{ + struct blk_desc *desc; + int ret; + + ret = uclass_first_device(UCLASS_BLK, devp); + if (ret) + return ret; + if (!*devp) + return -ENODEV; + do { + desc = dev_get_uclass_platdata(*devp); + if (desc->if_type == if_type) + return 0; + ret = uclass_next_device(devp); + if (ret) + return ret; + } while (*devp); + + return -ENODEV; +} + +int blk_next_device(struct udevice **devp) +{ + struct blk_desc *desc; + int ret, if_type; + + desc = dev_get_uclass_platdata(*devp); + if_type = desc->if_type; + do { + ret = uclass_next_device(devp); + if (ret) + return ret; + if (!*devp) + return -ENODEV; + desc = dev_get_uclass_platdata(*devp); + if (desc->if_type == if_type) + return 0; + } while (1); +} + +int blk_get_device(int if_type, int devnum, struct udevice **devp) +{ + struct uclass *uc; + struct udevice *dev; + int ret; + + ret = uclass_get(UCLASS_BLK, &uc); + if (ret) + return ret; + uclass_foreach_dev(dev, uc) { + struct blk_desc *desc = dev_get_uclass_platdata(dev); + + debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, + if_type, devnum, dev->name, desc->if_type, desc->devnum); + if (desc->if_type == if_type && desc->devnum == devnum) { + *devp = dev; + return device_probe(dev); + } + } + + return -ENODEV; +} + +unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, + lbaint_t blkcnt, void *buffer) +{ + struct udevice *dev = block_dev->bdev; + const struct blk_ops *ops = blk_get_ops(dev); + + if (!ops->read) + return -ENOSYS; + + return ops->read(dev, start, blkcnt, buffer); +} + +unsigned long blk_dwrite(struct blk_desc *block_dev, lbaint_t start, +lbaint_t blkcnt, const void *buffer) +{ + struct udevice *dev = block_dev->bdev; + const struct blk_ops *ops = blk_get_ops(dev); + + if (!ops->write) + return -ENOSYS; + + return ops->write(dev, start, blkcnt, buffer); +} + +unsigned long blk_derase(struct blk_desc *block_dev, lbaint_t start, +lbaint_t blkcnt) +{ + struct udevice *dev = block_dev->bdev; + const struct blk_ops *ops = blk_get_ops(dev); + + if (!ops->erase) + return -ENOSYS; + + return ops->erase(dev, start, blkcnt); +} + +int blk_prepare_device(struct udevice *dev) +{ + struct blk_desc *desc = dev_get_uclass_platdata
[U-Boot] [PATCH v2 32/32] Drop CONFIG_CRAMFS_CMDLINE
This option doesn't do anything. Drop it. Signed-off-by: Simon Glass Suggested-by: Bin Meng --- Changes in v2: None cmd/cramfs.c| 5 - include/configs/UCP1020.h | 1 - include/configs/km/keymile-common.h | 1 - include/configs/sandbox.h | 1 - 4 files changed, 8 deletions(-) diff --git a/cmd/cramfs.c b/cmd/cramfs.c index 270701b..c103491 100644 --- a/cmd/cramfs.c +++ b/cmd/cramfs.c @@ -29,7 +29,6 @@ # define DEBUGF(fmt, args...) #endif -#ifdef CONFIG_CRAMFS_CMDLINE #include #ifdef CONFIG_SYS_NO_FLASH @@ -201,7 +200,3 @@ U_BOOT_CMD( "[ directory ]\n" "- list files in a directory.\n" ); - -#endif /* #ifdef CONFIG_CRAMFS_CMDLINE */ - -/***/ diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h index 2354009..c21af1c 100644 --- a/include/configs/UCP1020.h +++ b/include/configs/UCP1020.h @@ -495,7 +495,6 @@ #define CONFIG_CMD_REGINFO #define CONFIG_CMD_ERRATA #define CONFIG_CMD_CRAMFS -#define CONFIG_CRAMFS_CMDLINE /* * USB diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index 91b29b3..5edc8f6 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -83,7 +83,6 @@ #define CONFIG_MTD_CONCAT #define CONFIG_CMD_CRAMFS -#define CONFIG_CRAMFS_CMDLINE #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS #define CONFIG_KM_DEF_ENV_BOOTPARAMS \ diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index f73d040..b7090c8 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -46,7 +46,6 @@ #define CONFIG_CMD_EXT4_WRITE #define CONFIG_CMD_CBFS #define CONFIG_CMD_CRAMFS -#define CONFIG_CRAMFS_CMDLINE #define CONFIG_CMD_PART #define CONFIG_DOS_PARTITION #define CONFIG_HOST_MAX_DEVICES 4 -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 26/32] dm: usb: Unbind old block devices when shutting down USB
We don't want old block devices hanging around since they can still appear visible in some way. Possibly we should unbind all devices which don't cause problems by being unbound. Most likely we can remove everything except USB controllers, hubs and emulators. We can consider that later. Signed-off-by: Simon Glass --- Changes in v2: None drivers/usb/host/usb-uclass.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 50538e0..69c9a50 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -159,7 +159,11 @@ int usb_stop(void) if (ret && !err) err = ret; } - +#ifdef CONFIG_BLK + ret = blk_unbind_all(IF_TYPE_USB); + if (ret && !err) + err = ret; +#endif #ifdef CONFIG_SANDBOX struct udevice *dev; -- 2.7.0.rc3.207.g0ac5344 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 25/32] dm: usb: Convert USB storage to use driver-model for block devs
Update this code to support CONFIG_BLK. Each USB storage device can have one or more block devices as children, each one representing a LUN (logical unit) of the USB device. Signed-off-by: Simon Glass --- Changes in v2: None common/usb_storage.c | 141 --- 1 file changed, 135 insertions(+), 6 deletions(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index 0475123..1472824 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -67,7 +68,9 @@ static __u32 CBWTag; static int usb_max_devs; /* number of highest available usb device */ +#ifndef CONFIG_BLK static struct blk_desc usb_dev_desc[USB_MAX_STOR_DEV]; +#endif struct us_data; typedef int (*trans_cmnd)(ccb *cb, struct us_data *data); @@ -108,7 +111,9 @@ struct us_data { #define USB_MAX_XFER_BLK 20 #endif +#ifndef CONFIG_BLK static struct us_data usb_stor[USB_MAX_STOR_DEV]; +#endif #define USB_STOR_TRANSPORT_GOOD 0 #define USB_STOR_TRANSPORT_FAILED -1 @@ -118,16 +123,33 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *us, struct blk_desc *dev_desc); int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss); +#ifdef CONFIG_BLK +static unsigned long usb_stor_read(struct udevice *dev, lbaint_t blknr, + lbaint_t blkcnt, void *buffer); +static unsigned long usb_stor_write(struct udevice *dev, lbaint_t blknr, + lbaint_t blkcnt, const void *buffer); +#else static unsigned long usb_stor_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer); static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer); +#endif void uhci_show_temp_int_td(void); #ifdef CONFIG_PARTITIONS struct blk_desc *usb_stor_get_dev(int index) { +#ifdef CONFIG_BLK + struct udevice *dev; + int ret; + + ret = blk_get_device(IF_TYPE_USB, index, &dev); + if (ret) + return NULL; + return dev_get_uclass_platdata(dev); +#else return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL; +#endif } #endif @@ -143,6 +165,19 @@ static void usb_show_progress(void) int usb_stor_info(void) { int count = 0; +#ifdef CONFIG_BLK + struct udevice *dev; + + for (blk_first_device(IF_TYPE_USB, &dev); +dev; +blk_next_device(&dev)) { + struct blk_desc *desc = dev_get_uclass_platdata(dev); + + printf(" Device %d: ", desc->devnum); + dev_print(desc); + count++; + } +#else int i; if (usb_max_devs > 0) { @@ -152,7 +187,7 @@ int usb_stor_info(void) } return 0; } - +#endif if (!count) { printf("No storage devices, perhaps not 'usb start'ed..?\n"); return 1; @@ -179,11 +214,63 @@ static unsigned int usb_get_max_lun(struct us_data *us) static int usb_stor_probe_device(struct usb_device *udev) { int lun, max_lun; + +#ifdef CONFIG_BLK + struct us_data *data; + char dev_name[30], *str; + int ret; +#else int start; if (udev == NULL) return -ENOENT; /* no more devices available */ +#endif + + debug("\n\nProbing for storage\n"); +#ifdef CONFIG_BLK + /* +* We store the us_data in the mass storage device's platdata. It +* is shared by all LUNs (block devices) attached to this mass storage +* device. +*/ + data = dev_get_platdata(udev->dev); + if (!usb_storage_probe(udev, 0, data)) + return 0; + max_lun = usb_get_max_lun(data); + for (lun = 0; lun <= max_lun; lun++) { + struct blk_desc *blkdev; + struct udevice *dev; + + snprintf(dev_name, sizeof(dev_name), "%s.lun%d", +udev->dev->name, lun); + str = strdup(dev_name); + if (!str) + return -ENOMEM; + ret = blk_create_device(udev->dev, "usb_storage_blk", str, + IF_TYPE_USB, usb_max_devs, 512, 0, &dev); + if (ret) { + debug("Cannot bind driver\n"); + return ret; + } + + blkdev = dev_get_uclass_platdata(dev); + blkdev->target = 0xff; + blkdev->lun = lun; + ret = usb_stor_get_info(udev, data, blkdev); + if (ret == 1) + ret = blk_prepare_device(dev); + if (!ret) { + usb_max_devs++; + debug("%s: Found device %p\n",
[U-Boot] [PATCH v2 24/32] dm: sandbox: Add driver-model block-device support for sandbox
Update the host driver to support driver model for block devices. A future commit will remove the old code, but for now it is useful to be able to use it both with and without CONFIG_BLK. Signed-off-by: Simon Glass --- Changes in v2: - Use snprintf() to avoid overflow cmd/host.c| 9 +++- drivers/block/sandbox.c | 118 +- include/sandboxblockdev.h | 2 + 3 files changed, 127 insertions(+), 2 deletions(-) diff --git a/cmd/host.c b/cmd/host.c index ee219ce..8d84415 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -80,7 +81,13 @@ static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc, continue; } - struct host_block_dev *host_dev = blk_dev->priv; + struct host_block_dev *host_dev; + +#ifdef CONFIG_BLK + host_dev = dev_get_priv(blk_dev->bdev); +#else + host_dev = blk_dev->priv; +#endif printf("%12lu %s\n", (unsigned long)blk_dev->lba, host_dev->filename); } diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index dde9d68..6d41508 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -4,14 +4,20 @@ * SPDX-License-Identifier:GPL-2.0+ */ -#include #include +#include +#include +#include #include #include #include #include #include +#include +DECLARE_GLOBAL_DATA_PTR; + +#ifndef CONFIG_BLK static struct host_block_dev host_devices[CONFIG_HOST_MAX_DEVICES]; static struct host_block_dev *find_host_device(int dev) @@ -21,7 +27,17 @@ static struct host_block_dev *find_host_device(int dev) return NULL; } +#endif + +#ifdef CONFIG_BLK +static unsigned long host_block_read(struct udevice *dev, +unsigned long start, lbaint_t blkcnt, +void *buffer) +{ + struct host_block_dev *host_dev = dev_get_priv(dev); + struct blk_desc *block_dev = dev_get_uclass_platdata(dev); +#else static unsigned long host_block_read(struct blk_desc *block_dev, unsigned long start, lbaint_t blkcnt, void *buffer) @@ -31,6 +47,7 @@ static unsigned long host_block_read(struct blk_desc *block_dev, if (!host_dev) return -1; +#endif if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) == -1) { @@ -43,12 +60,21 @@ static unsigned long host_block_read(struct blk_desc *block_dev, return -1; } +#ifdef CONFIG_BLK +static unsigned long host_block_write(struct udevice *dev, + unsigned long start, lbaint_t blkcnt, + const void *buffer) +{ + struct host_block_dev *host_dev = dev_get_priv(dev); + struct blk_desc *block_dev = dev_get_uclass_platdata(dev); +#else static unsigned long host_block_write(struct blk_desc *block_dev, unsigned long start, lbaint_t blkcnt, const void *buffer) { int dev = block_dev->devnum; struct host_block_dev *host_dev = find_host_device(dev); +#endif if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) == -1) { @@ -61,6 +87,70 @@ static unsigned long host_block_write(struct blk_desc *block_dev, return -1; } +#ifdef CONFIG_BLK +int host_dev_bind(int devnum, char *filename) +{ + struct host_block_dev *host_dev; + struct udevice *dev; + char dev_name[20], *str, *fname; + int ret, fd; + + /* Remove and unbind the old device, if any */ + ret = blk_get_device(IF_TYPE_HOST, devnum, &dev); + if (ret == 0) { + ret = device_remove(dev); + if (ret) + return ret; + ret = device_unbind(dev); + if (ret) + return ret; + } else if (ret != -ENODEV) { + return ret; + } + + if (!filename) + return 0; + + snprintf(dev_name, sizeof(dev_name), "host%d", devnum); + str = strdup(dev_name); + if (!str) + return -ENOMEM; + fname = strdup(filename); + if (!fname) { + free(str); + return -ENOMEM; + } + + fd = os_open(filename, OS_O_RDWR); + if (fd == -1) { + printf("Failed to access host backing file '%s'\n", filename); + ret = -ENOENT; + goto err; + } + ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str, + IF_TYPE_HOST, devnum, 512, + os_lseek(fd, 0, OS_SEEK_END), &dev); + if (ret) + goto err_file; + ret = device
[U-Boot] [PATCH v2 19/32] dm: block: Adjust device calls to go through helpers function
To ease conversion to driver model, add helper functions which deal with calling each block device method. With driver model we can reimplement these functions with the same arguments. Use inline functions to avoid increasing code size on some boards. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: None cmd/disk.c| 6 +++--- cmd/ide.c | 4 ++-- cmd/read.c| 2 +- cmd/usb.c | 6 ++ common/fb_mmc.c | 5 +++-- disk/part_amiga.c | 9 - disk/part_dos.c | 8 +++- disk/part_efi.c | 34 +++--- disk/part_iso.c | 6 +++--- disk/part_mac.c | 9 - fs/ext4/dev.c | 23 ++- fs/ext4/ext4_common.c | 27 +-- fs/fat/fat.c | 6 +++--- fs/fat/fat_write.c| 5 ++--- include/blk.h | 29 + test/dm/usb.c | 2 +- 16 files changed, 94 insertions(+), 87 deletions(-) diff --git a/cmd/disk.c b/cmd/disk.c index 27ed115..e0219f8 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -56,7 +56,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, ", Block Size: %ld\n", info.start, info.size, info.blksz); - if (dev_desc->block_read(dev_desc, info.start, 1, (ulong *)addr) != 1) { + if (blk_dread(dev_desc, info.start, 1, (ulong *)addr) != 1) { printf("** Read error on %d:%d\n", dev, part); bootstage_error(BOOTSTAGE_ID_IDE_PART_READ); return 1; @@ -100,8 +100,8 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc, cnt /= info.blksz; cnt -= 1; - if (dev_desc->block_read(dev_desc, info.start + 1, cnt, -(ulong *)(addr + info.blksz)) != cnt) { + if (blk_dread(dev_desc, info.start + 1, cnt, + (ulong *)(addr + info.blksz)) != cnt) { printf("** Read error on %d:%d\n", dev, part); bootstage_error(BOOTSTAGE_ID_IDE_READ); return 1; diff --git a/cmd/ide.c b/cmd/ide.c index dfd5548..c4c08c8 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -203,8 +204,7 @@ int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) #endif dev_desc = &ide_dev_desc[curr_device]; - n = dev_desc->block_read(dev_desc, blk, cnt, -(ulong *)addr); + n = blk_dread(dev_desc, blk, cnt, (ulong *)addr); /* flush cache after read */ flush_cache(addr, cnt * ide_dev_desc[curr_device].blksz); diff --git a/cmd/read.c b/cmd/read.c index f8d766a..61d8ce7 100644 --- a/cmd/read.c +++ b/cmd/read.c @@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } - if (dev_desc->block_read(dev_desc, offset + blk, cnt, addr) < 0) { + if (blk_read(dev_desc, offset + blk, cnt, addr) < 0) { printf("Error reading blocks\n"); return 1; } diff --git a/cmd/usb.c b/cmd/usb.c index 53fd6ad..9ed5dc6 100644 --- a/cmd/usb.c +++ b/cmd/usb.c @@ -759,8 +759,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("\nUSB read: device %d block # %ld, count %ld" " ... ", usb_stor_curr_dev, blk, cnt); stor_dev = usb_stor_get_dev(usb_stor_curr_dev); - n = stor_dev->block_read(stor_dev, blk, cnt, -(ulong *)addr); + n = blk_dread(stor_dev, blk, cnt, (ulong *)addr); printf("%ld blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR"); if (n == cnt) @@ -781,8 +780,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("\nUSB write: device %d block # %ld, count %ld" " ... ", usb_stor_curr_dev, blk, cnt); stor_dev = usb_stor_get_dev(usb_stor_curr_dev); - n = stor_dev->block_write(stor_dev, blk, cnt, - (ulong *)addr); + n = blk_dwrite(stor_dev, blk, cnt, (ulong *)addr); printf("%ld blocks write: %s\n", n, (n == cnt) ? "OK" : "ERROR"); if (n == cnt) diff --git a/common/fb_mmc.c b/common/fb_mmc.c index da7949f..e3abcc8 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -58,7 +59,