Re: [PATCH v2 0/5] Marvell EBU PCIe driver
On Tue, Jul 29, 2014 at 09:58:17PM +0200, Sebastian Hesselbarth wrote: On 07/28/2014 03:26 PM, Sebastian Hesselbarth wrote: Second round of the Marvell EBU PCIe driver patch set. Compared to v1, I reworked pci_scan_bus to properly set IORESOURCE flags for all resources, and added auto-incrementing pci bus numbering. Patch 1 is unchanged and still fixes resource computation of mbus driver. Patch 2 now properly sets IORESOURCE flags for I/O, 32b MEM, and 64b MEM resources. Patch 3 is a squashed and reworked patch dealing with pci host controller registration: bus number is now assigned from an auto- incremented bus_index and already provided pci_controller's set_busno is called right before pci_scan_bus to allow the controller to update internal registers related with bus number. This patch also sets a back-reference to the pci_controller of a pci_bus and cleans up some unused left-overs from Linux import. Patch 4 is unchanged import of of_pci_get_devfn() and Patch 5 finally adds the PCIe controller driver for Marvell MVEBU SoCs. Individual changelogs are also at the corresponding patch mails. Again, this has been tested on Armada 370 Mirabox. Sascha, before you consider applying this, I had the chance to test it on Armada XP, too. Both the driver and pci core need some more fixes, so please wait for v3. Ok, I removed all patches from -next. I'll wait for the next round of patches. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 0/2] i2c: add Marvell 64xxx driver; fix Makefile indentation
Sebastian, I'm fine with the driver. Will you ack it once your fine with it aswell? Sascha On Tue, Jul 29, 2014 at 04:47:15PM +0400, Antony Pavlov wrote: Changes since v2: * drop allwinner,sun* stuff; * make macros shorter (drop MV64XXX_I2C_ prefix); * rework mv64xxx_write/mv64xxx_read stuff; * drop mv64xxx_i2c_execute_msg(). * drop unused variables. Antony Pavlov (2): i2c: add Marvell 64xxx driver i2c: busses/Makefile: fix indentation drivers/i2c/busses/Kconfig | 8 + drivers/i2c/busses/Makefile | 5 +- drivers/i2c/busses/i2c-mv64xxx.c | 647 +++ 3 files changed, 658 insertions(+), 2 deletions(-) create mode 100644 drivers/i2c/busses/i2c-mv64xxx.c -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 0/2] i2c: add Marvell 64xxx driver; fix Makefile indentation
On 30.07.2014 08:35, Sascha Hauer wrote: I'm fine with the driver. Will you ack it once your fine with it aswell? Yeah, let me give it a shot on the most obvious platforms again. Will send my Acked-by later today. Sebastian On Tue, Jul 29, 2014 at 04:47:15PM +0400, Antony Pavlov wrote: Changes since v2: * drop allwinner,sun* stuff; * make macros shorter (drop MV64XXX_I2C_ prefix); * rework mv64xxx_write/mv64xxx_read stuff; * drop mv64xxx_i2c_execute_msg(). * drop unused variables. Antony Pavlov (2): i2c: add Marvell 64xxx driver i2c: busses/Makefile: fix indentation drivers/i2c/busses/Kconfig | 8 + drivers/i2c/busses/Makefile | 5 +- drivers/i2c/busses/i2c-mv64xxx.c | 647 +++ 3 files changed, 658 insertions(+), 2 deletions(-) create mode 100644 drivers/i2c/busses/i2c-mv64xxx.c -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 3/8] pci: pci_scan_bus: respect 64b BARs
In PCI 64-bit BARs span two 32-bit BARs, therefore if BAR type indicates a 64-bit BAR we have to skip the next BAR register. While at it, also set proper IORESOURCE flags for I/O and 32b MEM. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com Acked-by: Lucas Stach l.st...@pengutronix.de --- Changelog: v2-v3: - IORESOURCE_MEM_64 is ORed with IORESOURCE_MEM - write 0 to upper 64b BAR register v1-v2: - set resource flags for all resources found (Suggested by Lucas Stach) - use MEM_64 resource flag for BAR64 detection (Suggested by Lucas Stach) Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/pci/pci.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 3d88b0ff5fd0..83d44fc103f7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -211,19 +211,29 @@ unsigned int pci_scan_bus(struct pci_bus *bus) size = -(mask 0xfffe); DBG( PCI: pbar%d: mask=%08x io %d bytes\n, bar, mask, size); pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, last_io); + dev-resource[bar].flags = IORESOURCE_IO; last_addr = last_io; last_io += size; - } else { /* MEM */ size = -(mask 0xfff0); DBG( PCI: pbar%d: mask=%08x memory %d bytes\n, bar, mask, size); pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, last_mem); + dev-resource[bar].flags = IORESOURCE_MEM; last_addr = last_mem; last_mem += size; + + if ((mask PCI_BASE_ADDRESS_MEM_TYPE_MASK) == + PCI_BASE_ADDRESS_MEM_TYPE_64) { + dev-resource[bar].flags |= IORESOURCE_MEM_64; + pci_write_config_dword(dev, + PCI_BASE_ADDRESS_1 + bar * 4, 0); + } } dev-resource[bar].start = last_addr; dev-resource[bar].end = last_addr + size - 1; + if (dev-resource[bar].flags IORESOURCE_MEM_64) + bar++; } } -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 0/8] Marvell EBU PCIe driver
Third and hopefully last round of the Marvell EBU PCIe driver patch set. Compared to v2, I disabled MBUS error propagation on Armada 370/XP as it hangs the SoC on unanswered PCIe accesses. Also, 64b BARs are now properly handled. I added two more pci core fixes that move PCI device registration after BAR setup and temporarely disable PCI_COMMAND' IO and MEM bits during BAR setup. The MVEBU PCIe driver now gained support for Armada XP PHY setup which is anticipating a minor DT binding tweak to allow more than one marvell,pcie-lane passed to the node. Also, PCI address space does now also start at where we see it on MBUS. Some devices were not so happy about starting at 0. The whole series has been tested on Armada 370 Mirabox and Armada XP Lenovo Iomega ix4-300d (not mainline yet). Sebastian Sebastian Hesselbarth (8): bus: mvebu: fix resource size handling ARM: mvebu: armada-370-xp: disable MBUS error propagation pci: pci_scan_bus: respect 64b BARs pci: register device after BAR setup pci: ensure device does ignore BAR mangling pci: set auto-incremented bus number of: pci: import of_pci_get_devfn() pci: mvebu: Add PCIe driver arch/arm/Kconfig | 1 + arch/arm/mach-mvebu/armada-370-xp.c| 6 + .../mach-mvebu/include/mach/armada-370-xp-regs.h | 2 + drivers/bus/mvebu-mbus.c | 8 +- drivers/of/Kconfig | 6 + drivers/of/Makefile| 1 + drivers/of/of_pci.c| 27 ++ drivers/pci/Kconfig| 6 + drivers/pci/Makefile | 2 + drivers/pci/pci-mvebu-phy.c| 208 ++ drivers/pci/pci-mvebu.c| 446 + drivers/pci/pci-mvebu.h| 37 ++ drivers/pci/pci.c | 28 +- include/linux/pci.h| 12 +- include/of_pci.h | 17 + 15 files changed, 790 insertions(+), 17 deletions(-) create mode 100644 drivers/of/of_pci.c create mode 100644 drivers/pci/pci-mvebu-phy.c create mode 100644 drivers/pci/pci-mvebu.c create mode 100644 drivers/pci/pci-mvebu.h create mode 100644 include/of_pci.h --- Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 4/8] pci: register device after BAR setup
As soon as pci_register_device is called, a potential driver will access its registers. This requires BARs to be set up properly, so move pci_register_device after BAR setup. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com --- Changelog: v2-v3: - new patch Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 83d44fc103f7..f58e2c98f185 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -186,9 +186,6 @@ unsigned int pci_scan_bus(struct pci_bus *bus) DBG(PCI: %02x:%02x [%04x/%04x]\n, bus-number, dev-devfn, dev-vendor, dev-device); - list_add_tail(dev-bus_list, bus-devices); - pci_register_device(dev); - if (class == PCI_CLASS_BRIDGE_HOST) { DBG(PCI: skip pci host bridge\n); continue; @@ -235,6 +232,9 @@ unsigned int pci_scan_bus(struct pci_bus *bus) if (dev-resource[bar].flags IORESOURCE_MEM_64) bar++; } + + list_add_tail(dev-bus_list, bus-devices); + pci_register_device(dev); } /* -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 6/8] pci: set auto-incremented bus number
When using more than one PCI bus, we have to assign unique numbers to each bus. Use an auto-incremented bus index and assign it to each registered bus. Also, allow the PCI host controller to update internal registers by calling set_busno with assigned bus number. While at it, add pci_controller struct to set_busno callback, add a back reference to pci_controller to pci_bus, and clean up unused left-overs from Linux import. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com --- Changelog: v2-v3: - none v1-v2: - set pci_controller reference to bus-bus (Suggested by Lucas Stach) - auto-increment pci_bus number for each registered bus - call pci_controller set_busno() before pci_scan_bus - remove sysdata and proc_dir_entry from pci_dev and pci_bus - pass pci_controller to set_busno callback Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/pci/pci.c | 5 + include/linux/pci.h | 12 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b64f25d13282..a1b768025484 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -11,6 +11,7 @@ static struct pci_controller *hose_head, **hose_tail = hose_head; LIST_HEAD(pci_root_buses); EXPORT_SYMBOL(pci_root_buses); +static u8 bus_index; static struct pci_bus *pci_alloc_bus(void) { @@ -36,10 +37,14 @@ void register_pci_controller(struct pci_controller *hose) bus = pci_alloc_bus(); hose-bus = bus; + bus-host = hose; bus-ops = hose-pci_ops; bus-resource[0] = hose-mem_resource; bus-resource[1] = hose-io_resource; + bus-number = bus_index++; + if (hose-set_busno) + hose-set_busno(hose, bus-number); pci_scan_bus(bus); list_add_tail(bus-node, pci_root_buses); diff --git a/include/linux/pci.h b/include/linux/pci.h index 6caed01c9939..0ec1320b2f71 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -91,9 +91,6 @@ struct pci_dev { struct list_head bus_list; /* node in per-bus list */ struct pci_bus *bus; /* bus this device is on */ struct pci_bus *subordinate; /* bus this device bridges to */ - - void*sysdata; /* hook for sys-specific extension */ - struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ struct pci_slot *slot; /* Physical slot this device is in */ struct device_d dev; @@ -118,6 +115,7 @@ struct pci_dev { #defineto_pci_dev(dev) container_of(dev, struct pci_dev, dev) struct pci_bus { + struct pci_controller *host;/* associated host controller */ struct list_head node; /* node in list of buses */ struct list_head children; /* list of child buses */ struct list_head devices; /* list of devices on this bus */ @@ -126,8 +124,6 @@ struct pci_bus { struct list_head resources; /* address space routed to this bus */ struct pci_ops *ops; /* configuration access functions */ - void*sysdata; /* hook for sys-specific extension */ - struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ unsigned char number; /* bus number */ unsigned char primary;/* number of primary bridge */ @@ -167,10 +163,8 @@ struct pci_controller { unsigned int index; - /* Optional access methods for reading/writing the bus number - of the PCI controller */ - int (*get_busno)(void); - void (*set_busno)(int busno); + /* Optional access method for writing the bus number */ + void (*set_busno)(struct pci_controller *host, int busno); }; struct pci_driver { -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 7/8] of: pci: import of_pci_get_devfn()
Marvell MVEBU PCIe driver requires of_pcie_get_devfn(), import it from Linux. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com Acked-by: Lucas Stach l.st...@pengutronix.de --- Changelog: v2-v3: - still none v1-v2: - none Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/of/Kconfig | 6 ++ drivers/of/Makefile | 1 + drivers/of/of_pci.c | 27 +++ include/of_pci.h| 17 + 4 files changed, 51 insertions(+) create mode 100644 drivers/of/of_pci.c create mode 100644 include/of_pci.h diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 2b28cf3fb425..81955063d70c 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -27,6 +27,12 @@ config OF_GPIO depends on OFDEVICE def_bool y +config OF_PCI + bool + depends on PCI + help + OpenFirmware PCI bus accessors + config OF_BAREBOX_DRIVERS depends on OFDEVICE depends on ENV_HANDLING diff --git a/drivers/of/Makefile b/drivers/of/Makefile index c883e516c834..0dc2f8d63ed0 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,6 +1,7 @@ obj-y += address.o base.o fdt.o platform.o obj-$(CONFIG_OFTREE_MEM_GENERIC) += mem_generic.o obj-$(CONFIG_OF_GPIO) += of_gpio.o +obj-$(CONFIG_OF_PCI) += of_pci.o obj-y += partition.o obj-y += of_net.o obj-$(CONFIG_MTD) += of_mtd.o diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c new file mode 100644 index ..2d0fbd2e5f69 --- /dev/null +++ b/drivers/of/of_pci.c @@ -0,0 +1,27 @@ +#include common.h +#include errno.h +#include of.h +#include of_pci.h + +/** + * of_pci_get_devfn() - Get device and function numbers for a device node + * @np: device node + * + * Parses a standard 5-cell PCI resource and returns an 8-bit value that can + * be passed to the PCI_SLOT() and PCI_FUNC() macros to extract the device + * and function numbers respectively. On error a negative error code is + * returned. + */ +int of_pci_get_devfn(struct device_node *np) +{ + unsigned int size; + const __be32 *reg; + + reg = of_get_property(np, reg, size); + + if (!reg || size 5 * sizeof(__be32)) + return -EINVAL; + + return (be32_to_cpup(reg) 8) 0xff; +} +EXPORT_SYMBOL_GPL(of_pci_get_devfn); diff --git a/include/of_pci.h b/include/of_pci.h new file mode 100644 index ..c95cb0135ae0 --- /dev/null +++ b/include/of_pci.h @@ -0,0 +1,17 @@ +#ifndef __OF_PCI_H +#define __OF_PCI_H + +#include linux/pci.h + +#ifdef CONFIG_OF_PCI +int of_pci_get_devfn(struct device_node *np); + +#else +static inline int of_pci_get_devfn(struct device_node *np) +{ + return -EINVAL; +} + +#endif + +#endif -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 5/8] pci: ensure device does ignore BAR mangling
Disable access to PCI devices I/O and memory regions while mangling BAR registers. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com --- Changelog: v2-v3: - new patch Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/pci/pci.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f58e2c98f185..b64f25d13282 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -191,6 +191,10 @@ unsigned int pci_scan_bus(struct pci_bus *bus) continue; } + pci_read_config_byte(dev, PCI_COMMAND, cmd); + pci_write_config_byte(dev, PCI_COMMAND, + cmd ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)); + for (bar = 0; bar 6; bar++) { resource_size_t last_addr; @@ -233,6 +237,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus) bar++; } + pci_write_config_byte(dev, PCI_COMMAND, cmd); list_add_tail(dev-bus_list, bus-devices); pci_register_device(dev); } -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 8/8] pci: mvebu: Add PCIe driver
This adds a PCI driver for the controllers found on Marvell MVEBU SoCs. Besides the functional driver itself, it also adds SoC specific PHY setup required for PCIe. Currently, only Armada 370 is fully supported. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com Acked-by: Lucas Stach l.st...@pengutronix.de --- Changelog: v2-v3: - clarify Armada 370 PHY setup - add Armada XP PHY setup for x1 and x4 - map PCI address spaces to non-0 addresses - anticipate DT binding update for marvell,pcie-lane with multiple lanes and build up a lane mask v1-v2: - rework on top of pci controller changes - properly check for devfn passed from DT in mvebu_pcie_indirect_{rd,wr}_conf Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- arch/arm/Kconfig| 1 + drivers/pci/Kconfig | 6 + drivers/pci/Makefile| 2 + drivers/pci/pci-mvebu-phy.c | 208 + drivers/pci/pci-mvebu.c | 446 drivers/pci/pci-mvebu.h | 37 6 files changed, 700 insertions(+) create mode 100644 drivers/pci/pci-mvebu-phy.c create mode 100644 drivers/pci/pci-mvebu.c create mode 100644 drivers/pci/pci-mvebu.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8465d4a7f739..be5c7bd1981b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -93,6 +93,7 @@ config ARCH_MVEBU select GPIOLIB select HAS_DEBUG_LL select HAVE_PBL_MULTI_IMAGES + select HW_HAS_PCI select MVEBU_MBUS select OFTREE select OF_ADDRESS_PCI diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 9e4659270d25..d17a1510821f 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -24,6 +24,12 @@ config PCI_DEBUG When in doubt, say N. +config PCI_MVEBU + bool Marvell EBU PCIe driver + depends on ARCH_MVEBU + select OF_PCI + select PCI + endmenu endif diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index edac1a53de78..442353173c9e 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -6,3 +6,5 @@ obj-y += pci.o bus.o pci_iomap.o ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG CPPFLAGS += $(ccflags-y) + +obj-$(CONFIG_PCI_MVEBU)+= pci-mvebu.o pci-mvebu-phy.o diff --git a/drivers/pci/pci-mvebu-phy.c b/drivers/pci/pci-mvebu-phy.c new file mode 100644 index ..55a1d39f62b9 --- /dev/null +++ b/drivers/pci/pci-mvebu-phy.c @@ -0,0 +1,208 @@ +/* + * SoC specific PCIe PHY setup for Marvell MVEBU SoCs + * + * Sebastian Hesselbarth sebastian.hesselba...@gmail.com + * + * based on Marvell BSP code (C) Marvell International Ltd. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed as is without any + * warranty of any kind, whether express or implied. + */ + +#include common.h +#include of.h +#include of_address.h + +#include pci-mvebu.h + +static u32 mvebu_pcie_phy_indirect(void __iomem *phybase, u8 lane, + u8 off, u16 val, bool is_read) +{ + u32 reg = (lane 24) | (off 16) | val; + + if (is_read) + reg |= BIT(31); + writel(reg, phybase); + + return (is_read) ? readl(phybase) 0x : 0; +} + +static inline u32 mvebu_pcie_phy_read(void __iomem *phybase, u8 lane, + u8 off) +{ + return mvebu_pcie_phy_indirect(phybase, lane, off, 0, true); +} + +static inline void mvebu_pcie_phy_write(void __iomem *phybase, u8 lane, + u8 off, u16 val) +{ + mvebu_pcie_phy_indirect(phybase, lane, off, val, false); +} + +/* PCIe registers */ +#define ARMADA_370_XP_PCIE_LINK_CAPS 0x6c +#define MAX_LINK_WIDTH_MASK MAX_LINK_WIDTH(0x3f) +#define MAX_LINK_WIDTH(x) ((x) 4) +#define MAX_LINK_SPEED_MASK 0xf +#define MAX_LINK_SPEED_5G00x2 +#define MAX_LINK_SPEED_2G50x1 +#define ARMADA_370_XP_PHY_OFFSET 0x1b00 +/* System Control registers */ +#define ARMADA_370_XP_SOC_CTRL 0x04 +#define PCIE1_QUADX1_EN BIT(8) /* Armada XP */ +#define PCIE0_QUADX1_EN BIT(7) /* Armada XP */ +#define PCIE0_EN BIT(0) +#define ARMADA_370_XP_SERDES03_SEL 0x70 +#define ARMADA_370_XP_SERDES47_SEL 0x74 +#define SERDES(x, v) ((v) ((x) * 0x4)) +#define SERDES_MASK(x)SERDES((x), 0xf) + +int armada_370_phy_setup(struct mvebu_pcie *pcie) +{ + struct device_node *np = of_find_compatible_node(NULL, NULL, +marvell,armada-370-xp-system-controller); + void __iomem *sysctrl = of_iomap(np, 0); + void __iomem
[PATCH v3 1/8] bus: mvebu: fix resource size handling
A resource_size is defined as res-end - res-start + 1. Marvell MBUS driver gets some ranges from DT as start and size but mis-calculates end of range. This fixes 4 occurences of those mistakes. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com Acked-by: Lucas Stach l.st...@pengutronix.de --- Changelog: v2-v3: - still none v1-v2: - none Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/bus/mvebu-mbus.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c index 11e3777a6094..c67646f61722 100644 --- a/drivers/bus/mvebu-mbus.c +++ b/drivers/bus/mvebu-mbus.c @@ -187,7 +187,7 @@ static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, phys_addr_t base, size_t size, u8 target, u8 attr) { - u64 end = (u64)base + size; + u64 end = (u64)base + size - 1; int win; for (win = 0; win mbus-soc-num_wins; win++) { @@ -203,7 +203,7 @@ static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, if (!enabled) continue; - wend = wbase + wsize; + wend = wbase + wsize - 1; /* * Check if the current window overlaps with the @@ -661,7 +661,7 @@ static void mvebu_mbus_get_pcie_resources(struct device_node *np, reg, ARRAY_SIZE(reg)); if (!ret) { mem-start = reg[0]; - mem-end = mem-start + reg[1]; + mem-end = mem-start + reg[1] - 1; mem-flags = IORESOURCE_MEM; } @@ -669,7 +669,7 @@ static void mvebu_mbus_get_pcie_resources(struct device_node *np, reg, ARRAY_SIZE(reg)); if (!ret) { io-start = reg[0]; - io-end = io-start + reg[1]; + io-end = io-start + reg[1] - 1; io-flags = IORESOURCE_IO; } } -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 2/8] ARM: mvebu: armada-370-xp: disable MBUS error propagation
Accessing MBUS windows not backed-up by e.g. PCIe devices will hang the SoC. Disable MBUS error propagation back to CPU allows to read 0x instead of hanging the SoC. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com --- Changelog: v2-v3: - new patch Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- arch/arm/mach-mvebu/armada-370-xp.c | 6 ++ arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index e416a3876539..4eda6d539aab 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -46,10 +46,16 @@ static inline void armada_370_xp_memory_find(unsigned long *phys_base, static int armada_370_xp_init_soc(void) { unsigned long phys_base, phys_size; + u32 reg; barebox_set_model(Marvell Armada 370/XP); barebox_set_hostname(armada); + /* Disable MBUS error propagation */ + reg = readl(ARMADA_370_XP_FABRIC_BASE); + reg = ~BIT(8); + writel(reg, ARMADA_370_XP_FABRIC_BASE); + armada_370_xp_memory_find(phys_base, phys_size); arm_add_mem_device(ram0, phys_base, phys_size); diff --git a/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h index 5fd16e5733bb..ccc687c03b6e 100644 --- a/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h +++ b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h @@ -42,6 +42,8 @@ #define DDR_SIZE_CS_SHIFT 2 #define DDR_SIZE_MASK 0xff00 +#define ARMADA_370_XP_FABRIC_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x20200) + #define ARMADA_370_XP_TIMER_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x20300) #endif /* __MACH_MVEBU_DOVE_REGS_H */ -- 2.0.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 0/2] i2c: add Marvell 64xxx driver; fix Makefile indentation
On 30.07.2014 08:35, Sascha Hauer wrote: I'm fine with the driver. Will you ack it once your fine with it aswell? Hmm, it still throws a lot of I2C bus error on i2c_probe when no device is at that address and it still uses silly interrupt nomenclature. Anyway, it works and I'll maybe fix above someday, so Acked-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com and Tested-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com on Armada XP this time. Sebastian ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 3/3] saveenv: provide a zeroed/empty/ignore environment
If an external environment storage should be used in very rare and special cases, the intentional behaviour should be to ignore the external environment and always fall back to the built-in environment. By storing an empty to be ignored environment into the external environment a confusing error message about invalid CRC sums will go away and still the built-in environment is used. With this new option we can force the intentional behaviour. Signed-off-by: Juergen Borleis j...@pengutronix.de --- commands/saveenv.c | 30 ++ scripts/bareboxenv.c | 10 -- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/commands/saveenv.c b/commands/saveenv.c index 41f111d..84ddfa7 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -18,26 +18,39 @@ #include common.h #include command.h #include errno.h +#include getopt.h #include fs.h #include fcntl.h #include envfs.h static int do_saveenv(int argc, char *argv[]) { - int ret; + int ret, opt; + unsigned envfs_flags = 0; char *filename, *dirname; printf(saving environment\n); - if (argc 3) + while ((opt = getopt(argc, argv, z)) 0) { + switch (opt) { + case 'z': + envfs_flags |= ENVFS_FLAGS_PLACEHOLDER; + break; + } + } + + /* destination and source are given? */ + if (argc == optind + 2) + dirname = argv[optind + 1]; + else dirname = /env; + + /* destination only given? */ + if (argc == optind + 1) + filename = argv[optind]; else - dirname = argv[2]; - if (argc 2) filename = default_environment_path_get(); - else - filename = argv[1]; - ret = envfs_save(filename, dirname, 0); + ret = envfs_save(filename, dirname, envfs_flags); return ret; } @@ -49,13 +62,14 @@ BAREBOX_CMD_HELP_TEXT(ENVFS is usually a block in flash but can be any other fi BAREBOX_CMD_HELP_TEXT(omitted, DIRECTORY defaults to /env and ENVFS defaults to) BAREBOX_CMD_HELP_TEXT(/dev/env0. Note that envfs can only handle files, directories are being) BAREBOX_CMD_HELP_TEXT(skipped silently.) +BAREBOX_CMD_HELP_OPT (-z, store a 'zeroed' environment to force the built-in default environment at startup) BAREBOX_CMD_HELP_END BAREBOX_CMD_START(saveenv) .cmd= do_saveenv, BAREBOX_CMD_DESC(save environment to persistent storage) - BAREBOX_CMD_OPTS([ENVFS] [DIRECTORY]) + BAREBOX_CMD_OPTS([-z] [ENVFS [DIRECTORY]]) BAREBOX_CMD_GROUP(CMD_GRP_ENV) BAREBOX_CMD_HELP(cmd_saveenv_help) BAREBOX_CMD_END diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c index ec6ccfe..1936155 100644 --- a/scripts/bareboxenv.c +++ b/scripts/bareboxenv.c @@ -109,6 +109,7 @@ static void usage(char *prgname) \n options:\n -ssave (directory - environment sector)\n + -zforce the built-in default environment at startup\n -lload (environment sector - directory)\n -p size pad output file to given size\n -vverbose\n, @@ -120,9 +121,10 @@ int main(int argc, char *argv[]) int opt; int save = 0, load = 0, pad = 0, err = 0, fd; char *filename = NULL, *dirname = NULL; + unsigned envfs_flags = 0; int verbose = 0; - while((opt = getopt(argc, argv, slp:v)) != -1) { + while((opt = getopt(argc, argv, slp:vz)) != -1) { switch (opt) { case 's': save = 1; @@ -133,6 +135,10 @@ int main(int argc, char *argv[]) case 'p': pad = strtoul(optarg, NULL, 0); break; + case 'z': + envfs_flags |= ENVFS_FLAGS_PLACEHOLDER; + save = 1; + break; case 'v': verbose = 1; break; @@ -181,7 +187,7 @@ int main(int argc, char *argv[]) if (verbose) printf(saving contents of %s to file %s\n, dirname, filename); - err = envfs_save(filename, dirname, 0); + err = envfs_save(filename, dirname, envfs_flags); if (verbose err) printf(saving env failed: %d\n, err); -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 2/3] saveenv: change API to be able to forward special flags into the envfs superblock
In order to be able to mark an stored envfs image with special features (intentional ignore for example), we now can feed forward these flags. By forwarding a '0' for the flags nothing changes because the envfs superblock was already allocated with xzalloc. Signed-off-by: Juergen Borleis j...@pengutronix.de --- commands/saveenv.c | 2 +- common/environment.c | 24 +++- include/envfs.h | 2 +- scripts/bareboxenv.c | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/commands/saveenv.c b/commands/saveenv.c index 54b6fa1..41f111d 100644 --- a/commands/saveenv.c +++ b/commands/saveenv.c @@ -37,7 +37,7 @@ static int do_saveenv(int argc, char *argv[]) else filename = argv[1]; - ret = envfs_save(filename, dirname); + ret = envfs_save(filename, dirname, 0); return ret; } diff --git a/common/environment.c b/common/environment.c index a38e966..e135b0b 100644 --- a/common/environment.c +++ b/common/environment.c @@ -167,26 +167,29 @@ out: * Make the current environment persistent * @param[in] filename where to store * @param[in] dirname what to store (all files in this dir) + * @param[in] flags superblock flags (refer ENVFS_FLAGS_* macros) * @return 0 on success, anything else in case of failure * * Note: This function will also be used on the host! See note in the header * of this file. */ -int envfs_save(const char *filename, const char *dirname) +int envfs_save(const char *filename, const char *dirname, unsigned flags) { struct envfs_super *super; - int envfd, size, ret; + int envfd, size = 0, ret; struct action_data data; void *buf = NULL, *wbuf; data.writep = NULL; data.base = dirname; - /* first pass: calculate size */ - recursive_action(dirname, ACTION_RECURSE, file_size_action, -NULL, data, 0); + if (!(flags ENVFS_FLAGS_PLACEHOLDER)) { + /* first pass: calculate size */ + recursive_action(dirname, ACTION_RECURSE, file_size_action, + NULL, data, 0); - size = (unsigned long)data.writep; + size = (unsigned long)data.writep; + } buf = xzalloc(size + sizeof(struct envfs_super)); data.writep = buf + sizeof(struct envfs_super); @@ -196,10 +199,13 @@ int envfs_save(const char *filename, const char *dirname) super-major = ENVFS_MAJOR; super-minor = ENVFS_MINOR; super-size = ENVFS_32(size); + super-flags = ENVFS_32(flags); - /* second pass: copy files to buffer */ - recursive_action(dirname, ACTION_RECURSE, file_save_action, -NULL, data, 0); + if (!(flags ENVFS_FLAGS_PLACEHOLDER)) { + /* second pass: copy files to buffer */ + recursive_action(dirname, ACTION_RECURSE, file_save_action, + NULL, data, 0); + } super-crc = ENVFS_32(crc32(0, buf + sizeof(struct envfs_super), size)); super-sb_crc = ENVFS_32(crc32(0, buf, sizeof(struct envfs_super) - 4)); diff --git a/include/envfs.h b/include/envfs.h index edb559f..1bbf8b0 100644 --- a/include/envfs.h +++ b/include/envfs.h @@ -93,7 +93,7 @@ struct envfs_super { #define ENV_FLAG_NO_OVERWRITE (1 0) int envfs_load(const char *filename, const char *dirname, unsigned flags); -int envfs_save(const char *filename, const char *dirname); +int envfs_save(const char *filename, const char *dirname, unsigned flags); int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags); /* defaults to /dev/env0 */ diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c index da420db..ec6ccfe 100644 --- a/scripts/bareboxenv.c +++ b/scripts/bareboxenv.c @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) if (verbose) printf(saving contents of %s to file %s\n, dirname, filename); - err = envfs_save(filename, dirname); + err = envfs_save(filename, dirname, 0); if (verbose err) printf(saving env failed: %d\n, err); -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
envfs: provide an intentional way to ignore an existing external environment
Some use cases are using the barebox's built-in environment only, but still provide an external environment store to save a modified environment (for development purposes for example). In this case barebox works as intended even if the external store is empty and thus invalid. But even if it is an intentional behavior, barebox emits an error message due to an invalid content in the external store (CRC error). Because this error message will confuse a new user (how to know if this error message is important or can be ignored?) and it is a bad style to ship intentionally working systems with error messages, the following change set adds an empty environment feature to barebox. This change set adds a new option to the saveenv command which will write an empty environment without content. But it will be marked as a placeholder and thus should be ignored and barebox falls back to its built-in default environment. With this feature we now get: - if the environment store is empty, we still see an error message and barebox still falls back to its built-in default environment - if the environment store contains the new placeholder environment, there will be no error message but barebox falls back to its built-in default environment as well (intentional behaviour) - if the environment store contains a regular environment (modified compared to the built-in one) barebox will continue to use it and ignores its built-in default environment instead. Comments are welcome. Juergen ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] images: get rid of remaining imximage-y
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- images/Makefile.imx | 5 - 1 file changed, 5 deletions(-) diff --git a/images/Makefile.imx b/images/Makefile.imx index 1d0edd2..6e83f85 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -92,7 +92,6 @@ image-$(CONFIG_MACH_TQMA6X) += barebox-tq-tqma6q-mba6x.img pblx-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01_4gib CFG_start_phytec_pbab01_4gib.pblx.imximg = $(board)/phytec-phyflex-imx6/flash-header-phytec-pfla02-4gib.imxcfg -imximage-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01_4gib.pblx.imximg FILE_barebox-phytec-pbab01-4gib.img = start_phytec_pbab01_4gib.pblx.imximg image-$(CONFIG_MACH_PHYTEC_PFLA02) += barebox-phytec-pbab01-4gib.img @@ -108,13 +107,11 @@ image-$(CONFIG_MACH_PHYTEC_PFLA02) += barebox-phytec-pbab01-1gib.img pblx-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01dl_1gib CFG_start_phytec_pbab01dl_1gib.pblx.imximg = $(board)/phytec-phyflex-imx6/flash-header-phytec-pfla02dl-1gib.imxcfg -imximage-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01dl_1gib.pblx.imximg FILE_barebox-phytec-pbab01dl-1gib.img = start_phytec_pbab01dl_1gib.pblx.imximg image-$(CONFIG_MACH_PHYTEC_PFLA02) += barebox-phytec-pbab01dl-1gib.img pblx-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01s_512mb CFG_start_phytec_pbab01s_512mb.pblx.imximg = $(board)/phytec-phyflex-imx6/flash-header-phytec-pfla02s-512mb.imxcfg -imximage-$(CONFIG_MACH_PHYTEC_PFLA02) += start_phytec_pbab01s_512mb.pblx.imximg FILE_barebox-phytec-pbab01s-512mb.img = start_phytec_pbab01s_512mb.pblx.imximg image-$(CONFIG_MACH_PHYTEC_PFLA02) += barebox-phytec-pbab01s-512mb.img @@ -125,13 +122,11 @@ image-$(CONFIG_MACH_DFI_FS700_M60) += barebox-dfi-fs700-m60-6s.img pblx-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6q_dfi_fs700_m60_6q_micron CFG_start_imx6q_dfi_fs700_m60_6q_micron.pblx.imximg = $(board)/dfi-fs700-m60/flash-header-fs700-m60-6q-micron.imxcfg -imximage-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6q_dfi_fs700_m60_6q_micron.pblx.imximg FILE_barebox-dfi-fs700-m60-6q-micron.img = start_imx6q_dfi_fs700_m60_6q_micron.pblx.imximg image-$(CONFIG_MACH_DFI_FS700_M60) += barebox-dfi-fs700-m60-6q-micron.img pblx-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6q_dfi_fs700_m60_6q_nanya CFG_start_imx6q_dfi_fs700_m60_6q_nanya.pblx.imximg = $(board)/dfi-fs700-m60/flash-header-fs700-m60-6q-nanya.imxcfg -imximage-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6q_dfi_fs700_m60_6q_nanya.pblx.imximg FILE_barebox-dfi-fs700-m60-6q-nanya.img = start_imx6q_dfi_fs700_m60_6q_nanya.pblx.imximg image-$(CONFIG_MACH_DFI_FS700_M60) += barebox-dfi-fs700-m60-6q-nanya.img -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: envfs: provide an intentional way to ignore an existing external environment
Hi Jürgen! This looks good so far. On Wed, 2014-07-30 at 12:20 +0200, Juergen Borleis wrote: This change set adds a new option to the saveenv command which will write an empty environment without content. But it will be marked as a placeholder and thus should be ignored and barebox falls back to its built-in default environment. I haven't found where the environment loading is changed to implement this behavior. Is a patch missing? Thanks, Jan -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/5] MIPS: dts: rzx50.dts: add LCD backlight
Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- arch/mips/dts/rzx50.dts | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/mips/dts/rzx50.dts b/arch/mips/dts/rzx50.dts index 360c1bf..7ec3352 100644 --- a/arch/mips/dts/rzx50.dts +++ b/arch/mips/dts/rzx50.dts @@ -9,6 +9,16 @@ memory { reg = 0x 0x400; }; + + gpio-leds { + compatible = gpio-leds; + + lcd-backlight-enable { + label = lcd backlight; + gpios = gpio4 22 0; + linux,default-trigger = default-on; + }; + }; }; serial1 { -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 2/5] MIPS: ritmix-rzx50_defconfig: enable LED-related stuff
Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- arch/mips/configs/ritmix-rzx50_defconfig | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/configs/ritmix-rzx50_defconfig b/arch/mips/configs/ritmix-rzx50_defconfig index e6f10fb..232faa2 100644 --- a/arch/mips/configs/ritmix-rzx50_defconfig +++ b/arch/mips/configs/ritmix-rzx50_defconfig @@ -29,12 +29,18 @@ CONFIG_CMD_GETOPT=y CONFIG_CMD_SLEEP=y CONFIG_CMD_EDIT=y CONFIG_CMD_GPIO=y +CONFIG_CMD_LED=y CONFIG_CMD_POWEROFF=y +CONFIG_CMD_LED_TRIGGER=y CONFIG_CMD_OF_NODE=y CONFIG_CMD_OF_PROPERTY=y CONFIG_CMD_OFTREE=y CONFIG_OFDEVICE=y # CONFIG_SPI is not set +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_LED_GPIO_OF=y +CONFIG_LED_TRIGGERS=y CONFIG_GPIO_JZ4740=y CONFIG_SHA1=y CONFIG_SHA224=y -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 3/5] led: triggers: fix crash on disabling default-on trigger
Here is a sample crash log on Ritmix RZX-50: barebox:/ trigger 0: panic 1: heartbeat 2: net rx 3: net tx 4: net 5: default on (led 0) barebox:/ trigger -d 5 ... Ooops, TLB miss on store! Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- drivers/led/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c index 5eaf732..1a5a09f 100644 --- a/drivers/led/led-triggers.c +++ b/drivers/led/led-triggers.c @@ -124,7 +124,7 @@ int led_set_trigger(enum led_trigger trigger, struct led *led) triggers[trigger].led = led; - if (trigger == LED_TRIGGER_DEFAULT_ON) + if (led trigger == LED_TRIGGER_DEFAULT_ON) led_set(triggers[trigger].led, triggers[trigger].led-max_value); return 0; -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 5/5] led: triggers: fix no previous prototype for 'trigger_init' warning
Here is compiler's message: drivers/led/led-triggers.c:148:5: warning: no previous prototype for 'trigger_init' [-Wmissing-prototypes] int trigger_init(void) ^ Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- drivers/led/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c index 1a5a09f..c5484d5 100644 --- a/drivers/led/led-triggers.c +++ b/drivers/led/led-triggers.c @@ -145,7 +145,7 @@ int led_get_trigger(enum led_trigger trigger) return led_get_number(triggers[trigger].led); } -int trigger_init(void) +static int trigger_init(void) { return poller_register(trigger_poller); } -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 0/5] led-related series
Antony Pavlov (5): MIPS: dts: rzx50.dts: add LCD backlight MIPS: ritmix-rzx50_defconfig: enable LED-related stuff led: triggers: fix crash on disabling default-on trigger commands: trigger: check trigger disable return code too led: triggers: fix no previous prototype for 'trigger_init' warning arch/mips/configs/ritmix-rzx50_defconfig | 6 ++ arch/mips/dts/rzx50.dts | 10 ++ commands/trigger.c | 5 +++-- drivers/led/led-triggers.c | 4 ++-- 4 files changed, 21 insertions(+), 4 deletions(-) -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 4/5] commands: trigger: check trigger disable return code too
Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- commands/trigger.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/trigger.c b/commands/trigger.c index 17c8411..b605448 100644 --- a/commands/trigger.c +++ b/commands/trigger.c @@ -68,8 +68,9 @@ static int do_trigger(int argc, char *argv[]) break; case LED_COMMAND_DISABLE_TRIGGER: - led_set_trigger(trigger, NULL); - return 0; + ret = led_set_trigger(trigger, NULL); + break; + case LED_COMMAND_SET_TRIGGER: if (argc - optind != 1) return COMMAND_ERROR_USAGE; -- 2.0.1 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: envfs: provide an intentional way to ignore an existing external environment
On Wed, Jul 30, 2014 at 05:28:13PM +0200, Jan Lübbe wrote: Hi Jürgen! This looks good so far. On Wed, 2014-07-30 at 12:20 +0200, Juergen Borleis wrote: This change set adds a new option to the saveenv command which will write an empty environment without content. But it will be marked as a placeholder and thus should be ignored and barebox falls back to its built-in default environment. I haven't found where the environment loading is changed to implement this behavior. Is a patch missing? It's in the first patch. envfs_check_super is changed to return an error when the ENVFS_FLAGS_PLACEHOLDER flag is set. Then barebox will fall back to the default environment. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] watchdog: add minimal jz4740 driver
Also move reset_cpu() for jz4755 SoC from platform code into the new driver code. At the moment mach-xburst lacks clk support so jz4740 watchdog driver looks like a template. We can improve jz4740 watchdog driver in the future after adding clk support Signed-off-by: Antony Pavlov antonynpav...@gmail.com --- arch/mips/dts/jz4755.dtsi | 5 ++ arch/mips/mach-xburst/Kconfig | 2 + arch/mips/mach-xburst/include/mach/jz4750d_regs.h | 22 - arch/mips/mach-xburst/reset-jz4750.c | 18 - drivers/watchdog/Kconfig | 7 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/jz4740.c | 98 +++ 7 files changed, 113 insertions(+), 40 deletions(-) diff --git a/arch/mips/dts/jz4755.dtsi b/arch/mips/dts/jz4755.dtsi index 0e655b6..7184635 100644 --- a/arch/mips/dts/jz4755.dtsi +++ b/arch/mips/dts/jz4755.dtsi @@ -8,6 +8,11 @@ #size-cells = 1; ranges; + wdt: wdt@b0002000 { + compatible = ingenic,jz4740-wdt; + reg = 0xb0002000 0x10; + }; + serial0: serial@b003 { compatible = ingenic,jz4740-uart; reg = 0xb003 0x20; diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig index 706d592..f7b8470 100644 --- a/arch/mips/mach-xburst/Kconfig +++ b/arch/mips/mach-xburst/Kconfig @@ -6,6 +6,8 @@ config ARCH_TEXT_BASE config CPU_JZ4755 bool + select WATCHDOG + select WATCHDOG_JZ4740 choice prompt Board type diff --git a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h index 7a3daad..396c823 100644 --- a/arch/mips/mach-xburst/include/mach/jz4750d_regs.h +++ b/arch/mips/mach-xburst/include/mach/jz4750d_regs.h @@ -59,28 +59,6 @@ #define TCU_OSTCSR_PCK_EN (1 0) /* select pclk as the timer clock input */ /* - * WDT (WatchDog Timer) - */ -#define WDT_TDR(WDT_BASE + 0x00) -#define WDT_TCER (WDT_BASE + 0x04) -#define WDT_TCNT (WDT_BASE + 0x08) -#define WDT_TCSR (WDT_BASE + 0x0c) - -#define WDT_TCSR_PRESCALE_BIT 3 -#define WDT_TCSR_PRESCALE_MASK (0x7 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE1(0x0 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE4(0x1 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE16 (0x2 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE64 (0x3 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE256 (0x4 WDT_TCSR_PRESCALE_BIT) - #define WDT_TCSR_PRESCALE1024 (0x5 WDT_TCSR_PRESCALE_BIT) -#define WDT_TCSR_EXT_EN(1 2) -#define WDT_TCSR_RTC_EN(1 1) -#define WDT_TCSR_PCK_EN(1 0) - -#define WDT_TCER_TCEN (1 0) - -/* * RTC */ #define RTC_RCR(RTC_BASE + 0x00) /* RTC Control Register */ diff --git a/arch/mips/mach-xburst/reset-jz4750.c b/arch/mips/mach-xburst/reset-jz4750.c index 8f33672..25830f1 100644 --- a/arch/mips/mach-xburst/reset-jz4750.c +++ b/arch/mips/mach-xburst/reset-jz4750.c @@ -24,8 +24,6 @@ #include io.h #include mach/jz4750d_regs.h -#define JZ_EXTAL 2400 - static void __noreturn jz4750d_halt(void) { while (1) { @@ -39,22 +37,6 @@ static void __noreturn jz4750d_halt(void) unreachable(); } -void __noreturn reset_cpu(ulong addr) -{ - __raw_writew(WDT_TCSR_PRESCALE4 | WDT_TCSR_EXT_EN, (u16 *)WDT_TCSR); - __raw_writew(0, (u16 *)WDT_TCNT); - - /* reset after 4ms */ - __raw_writew(JZ_EXTAL / 1000, (u16 *)WDT_TDR); - /* enable wdt clock */ - __raw_writel(TCU_TSCR_WDTSC, (u32 *)TCU_TSCR); - /* start wdt */ - __raw_writeb(WDT_TCER_TCEN, (u8 *)WDT_TCER); - - unreachable(); -} -EXPORT_SYMBOL(reset_cpu); - void __noreturn poweroff() { u32 ctrl; diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 2e2900c..7f7b02e 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -21,4 +21,11 @@ config WATCHDOG_IMX depends on ARCH_IMX help Add support for watchdog found on Freescale i.MX SoCs. + +config WATCHDOG_JZ4740 + bool Ingenic jz4740 SoC hardware watchdog + depends on MACH_MIPS_XBURST + help + Hardware driver for the built-in watchdog timer on Ingenic jz4740 SoCs. + endif diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index f522b88..865fc47 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_WATCHDOG) +=
Re: [PATCH v3 0/8] Marvell EBU PCIe driver
On Wed, Jul 30, 2014 at 10:39:32AM +0200, Sebastian Hesselbarth wrote: Third and hopefully last round of the Marvell EBU PCIe driver patch set. Compared to v2, I disabled MBUS error propagation on Armada 370/XP as it hangs the SoC on unanswered PCIe accesses. Also, 64b BARs are now properly handled. I added two more pci core fixes that move PCI device registration after BAR setup and temporarely disable PCI_COMMAND' IO and MEM bits during BAR setup. The MVEBU PCIe driver now gained support for Armada XP PHY setup which is anticipating a minor DT binding tweak to allow more than one marvell,pcie-lane passed to the node. Also, PCI address space does now also start at where we see it on MBUS. Some devices were not so happy about starting at 0. The whole series has been tested on Armada 370 Mirabox and Armada XP Lenovo Iomega ix4-300d (not mainline yet). Sebastian Ok, applied, thanks Sascha Sebastian Hesselbarth (8): bus: mvebu: fix resource size handling ARM: mvebu: armada-370-xp: disable MBUS error propagation pci: pci_scan_bus: respect 64b BARs pci: register device after BAR setup pci: ensure device does ignore BAR mangling pci: set auto-incremented bus number of: pci: import of_pci_get_devfn() pci: mvebu: Add PCIe driver arch/arm/Kconfig | 1 + arch/arm/mach-mvebu/armada-370-xp.c| 6 + .../mach-mvebu/include/mach/armada-370-xp-regs.h | 2 + drivers/bus/mvebu-mbus.c | 8 +- drivers/of/Kconfig | 6 + drivers/of/Makefile| 1 + drivers/of/of_pci.c| 27 ++ drivers/pci/Kconfig| 6 + drivers/pci/Makefile | 2 + drivers/pci/pci-mvebu-phy.c| 208 ++ drivers/pci/pci-mvebu.c| 446 + drivers/pci/pci-mvebu.h| 37 ++ drivers/pci/pci.c | 28 +- include/linux/pci.h| 12 +- include/of_pci.h | 17 + 15 files changed, 790 insertions(+), 17 deletions(-) create mode 100644 drivers/of/of_pci.c create mode 100644 drivers/pci/pci-mvebu-phy.c create mode 100644 drivers/pci/pci-mvebu.c create mode 100644 drivers/pci/pci-mvebu.h create mode 100644 include/of_pci.h --- Cc: barebox@lists.infradead.org Cc: Antony Pavlov antonynpav...@gmail.com Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Cc: Lucas Stach l.st...@pengutronix.de Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Ezequiel Garcia ezequiel.gar...@free-electrons.com -- 2.0.0 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v4 0/9] Add a simple rtc framework
On Wed, Jul 30, 2014 at 12:10:16AM +0400, Antony Pavlov wrote: Changes since RFC v3: * rebase over latest 'next'; * hwclock: add additional checks; * add jz4740 driver; make appropriate changes for jz4755 and Ritmix RZX50 support; * fix copyright information. Changes since RFC v2: * rtc/Kconfig: fix formatting, dependencies and help sections; * hwclock: read time into environment variable. Changes since RFC v1: * rebase over latest 'next'; * fix copy'n'paste side effects; * add hwclock set time function; * make hwclock options more close to util-linux hwclock; * rtc-ds1307: add ds1338 chip support (used in versatile); * use qemu-versatile for testing. Antony Pavlov (9): lib: import 'bcd' from linux-3.15 Add a simple rtc framework rtc: import ds1307 driver from linux-3.15 commands: add hwclock ARM: versatilepb_defconfig: enable RTC support rtc-lib: import rtc_time_to_tm() from linux-3.15 rtc: add jz4740 driver MIPS: dts: jz4755.dtsi: add jz4740-rtc MIPS: ritmix-rzx50_defconfig: enable RTC support Applied, thanks Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 5/6] net: Add driver for Armada 370/XP 10/100/1000 Mbps network controller
Hi Ezequiel, Looks mostly fine, only one small comment from me. On Tue, Jul 29, 2014 at 05:45:00PM -0300, Ezequiel Garcia wrote: + +static int mvneta_probe(struct device_d *dev) +{ + struct mvneta_port *priv; + int ret; + + priv = xzalloc(sizeof(*priv)); + + priv-reg = dev_get_mem_region(dev, 0); Any special reason to use dev_get_mem_region() here? Normally you should use dev_request_mem_region() which allocates the resource for exclusive use. dev_get_mem_region() should only be used in very special cases. Please check the return value. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 0/6] Add network support for Armada 370/XP
Hi Ezequiel, On Tue, Jul 29, 2014 at 05:44:55PM -0300, Ezequiel Garcia wrote: This patchset adds support for the network controller found on Marvell Armada 370/XP SoC. The first patch is needed to parse the PHY property used in the current devicetree, which uses 'phy' instead of 'phy-handle'. While here, the patch adds support for the two obsolete DT PHY properties: 'phy' and 'phy-device'. The second patch is actually an improvement. It makes the clock a required property of the mvmdio driver, which makes the probing of the device more robust, and prevents the annoying freezing when the clock is not provided. The third patch supports the QSGMII interface. The fourth patch adds support for the Marvell 88E1545 PHY chip. There's not much work to do, except configuring the QSGMII interface. This chip is present in Marvell's Armada XP GP board. The fifth patch adds the mvneta driver. Most of the configuration part is based on Linux's mvneta driver, while some of code organization is based on Barebox's orion-gbe driver. The last patch adds network support in the defconfigs. This has been tested on the Armada XP GP board only. I'll try to test Openblocks AX3 and Mirabox in the following days. However, we might need some special PHY support for each them, as the Openblocks AX3 has a 88E1543 PHY, and the Mirabox has a 88E1510 PHY. Ezequiel Garcia (6): net: phy: Add fallbacks for the obsoletes phy DT properties net: phy: mdio-mvebu: Make the clock property required net: phy: Add minimal support for QSGMII PHY net: phy: Support Marvell 88EE1545 PHY net: Add driver for Armada 370/XP 10/100/1000 Mbps network controller configs: Add network options to Armada 370/XP boards I applied up to 3/6 for now. The network driver needs a small fix. Please let me know once you're happy enough with the phy support to apply it. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 0/2] i2c: add Marvell 64xxx driver; fix Makefile indentation
On Wed, Jul 30, 2014 at 10:54:50AM +0200, Sebastian Hesselbarth wrote: On 30.07.2014 08:35, Sascha Hauer wrote: I'm fine with the driver. Will you ack it once your fine with it aswell? Hmm, it still throws a lot of I2C bus error on i2c_probe when no device is at that address This message should really be removed as it's expected behaviour on i2c_probe. Anyway, users of this driver should be annoyed enough pretty soon so they send a patch, so: Applied. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox