[U-Boot] [PATCH v4 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds device tree binding for MDIO bus. Signed-off-by: Ken Ma Reviewed-by: s...@chromium.org, joe.hershber...@ni.com --- Changes in v4: - Minor updates for comments and Maintainer. Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS | 1 + doc/device-tree-bindings/net/mdio-bus.txt | 54 ++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 18 + drivers/net/mdio/Makefile | 6 ++ drivers/net/mdio/mdio-uclass.c| 112 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 + 9 files changed, 257 insertions(+) create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 include/net/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..07f7c66 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -432,6 +432,7 @@ M: Joe Hershberger S: Maintained T: git git://git.denx.de/u-boot-net.git F: drivers/net/ +F: drivers/net/mdio/ F: net/ NIOS diff --git a/doc/device-tree-bindings/net/mdio-bus.txt b/doc/device-tree-bindings/net/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/net/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..0e0982c 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig" source "drivers/net/Kconfig" +source "drivers/net/mdio/Kconfig" + source "drivers/nvme/Kconfig" source "drivers/pci/Kconfig" diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 584bfdf..1cda03f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o obj-$(CONFIG_FSL_PFE) += pfe_eth/ +obj-$(CONFIG_MDIO) += mdio/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig new file mode 100644 index 000..c065baa --- /dev/null +++ b/drivers/net/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config MDIO + bool "Enable MDIO (Management Data
[U-Boot] [PATCH v4 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma Reviewed-by: Chris Packham --- Changes in v4: - Use wait_for_bit_le32() instead of implementing private busy wait polling function. Changes in v3: - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS | 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 +++ drivers/net/mdio/Kconfig | 10 ++ drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mvmdio.c | 200 ++ 6 files changed, 231 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 drivers/net/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index 07f7c66..d737aed 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/net/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..e52b164 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/net/marvell-mdio.txt b/doc/device-tree-bindings/net/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/net/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index c065baa..a2271e0 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -15,4 +15,14 @@ config MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 45ae502..8b2e5a4 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/net/mdio/mvmdio.c b/drivers/net/mdio/mvmdio.c new file mode 100644 index 000..57224b5 --- /dev/null +++ b/drivers/net/mdio/mvmdio.c @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION
[U-Boot] [PATCH v4 0/2] Add MDIO driver model support
From: Ken Ma Changes in v4: - Minor updates for comments and Maintainer. - Use wait_for_bit_le32() instead of implementing private busy wait polling function. Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added. - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS | 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 +++ doc/device-tree-bindings/net/mdio-bus.txt | 54 +++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 28 drivers/net/mdio/Makefile | 7 + drivers/net/mdio/mdio-uclass.c| 112 +++ drivers/net/mdio/mvmdio.c | 200 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 12 files changed, 488 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 drivers/net/mdio/mvmdio.c create mode 100644 include/net/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds device tree binding for MDIO bus. Signed-off-by: Ken Ma Reviewed-by: s...@chromium.org, joe.hershber...@ni.com --- Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added, Changes in v2: None MAINTAINERS | 1 + doc/device-tree-bindings/net/mdio-bus.txt | 54 ++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 18 + drivers/net/mdio/Makefile | 6 ++ drivers/net/mdio/mdio-uclass.c| 112 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 + 9 files changed, 257 insertions(+) create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 include/net/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..9e1fc83 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -335,6 +335,7 @@ M: Simon Glass S: Maintained T: git git://git.denx.de/u-boot-dm.git F: drivers/core/ +F: drivers/net/mdio/ F: include/dm/ F: test/dm/ diff --git a/doc/device-tree-bindings/net/mdio-bus.txt b/doc/device-tree-bindings/net/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/net/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..0e0982c 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig" source "drivers/net/Kconfig" +source "drivers/net/mdio/Kconfig" + source "drivers/nvme/Kconfig" source "drivers/pci/Kconfig" diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 584bfdf..1cda03f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o obj-$(CONFIG_FSL_PFE) += pfe_eth/ +obj-$(CONFIG_MDIO) += mdio/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig new file mode 100644 index 000..533cc4a --- /dev/null +++ b/drivers/net/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config MDIO + bool "Enable MDIO(Management Data Input/Output) drivers" + depends on DM + help + Enable driver model for MDIO access. + Drivers provide methods to management data + Input/Output. + MDIO uclass provides interfaces
[U-Boot] [PATCH v3 0/2] Add MDIO driver model support
From: Ken Ma Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added, - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS | 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 ++ doc/device-tree-bindings/net/mdio-bus.txt | 54 ++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 28 +++ drivers/net/mdio/Makefile | 7 + drivers/net/mdio/mdio-uclass.c| 112 drivers/net/mdio/mvmdio.c | 234 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 +++ 12 files changed, 522 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 drivers/net/mdio/mvmdio.c create mode 100644 include/net/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma Reviewed-by: Chris Packham --- Changes in v3: - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS | 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 ++ drivers/net/mdio/Kconfig | 10 ++ drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mvmdio.c | 234 ++ 6 files changed, 265 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 drivers/net/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index 9e1fc83..d8584f9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/net/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..e52b164 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/net/marvell-mdio.txt b/doc/device-tree-bindings/net/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/net/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index 533cc4a..d1a31e6 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -15,4 +15,14 @@ config MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 45ae502..8b2e5a4 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/net/mdio/mvmdio.c b/drivers/net/mdio/mvmdio.c new file mode 100644 index 000..0fb45ce --- /dev/null +++ b/drivers/net/mdio/mvmdio.c @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION 0 +#define MVMDIO_SMI_READ_VALID BIT(27) +#define MVMDIO_SMI_BUSYBIT(28) +
[U-Boot] [PATCH v3 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma Reviewed-by: Chris Packham --- Changes in v3: - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS | 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 ++ drivers/net/mdio/Kconfig | 10 ++ drivers/net/mdio/Makefile | 1 + drivers/net/mdio/mvmdio.c | 234 ++ 6 files changed, 265 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 drivers/net/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index 9e1fc83..d8584f9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/net/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..e52b164 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/net/marvell-mdio.txt b/doc/device-tree-bindings/net/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/net/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig index 533cc4a..d1a31e6 100644 --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig @@ -15,4 +15,14 @@ config MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile index 45ae502..8b2e5a4 100644 --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/net/mdio/mvmdio.c b/drivers/net/mdio/mvmdio.c new file mode 100644 index 000..0fb45ce --- /dev/null +++ b/drivers/net/mdio/mvmdio.c @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION 0 +#define MVMDIO_SMI_READ_VALID BIT(27) +#define MVMDIO_SMI_BUSYBIT(28) +
[U-Boot] [PATCH v3 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds evice tree binding for MDIO bus. Signed-off-by: Ken Ma Reviewed-by: s...@chromium.org, joe.hershber...@ni.com --- Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added, Changes in v2: None MAINTAINERS | 1 + doc/device-tree-bindings/net/mdio-bus.txt | 54 ++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 18 + drivers/net/mdio/Makefile | 6 ++ drivers/net/mdio/mdio-uclass.c| 112 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 + 9 files changed, 257 insertions(+) create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 include/net/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..9e1fc83 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -335,6 +335,7 @@ M: Simon Glass S: Maintained T: git git://git.denx.de/u-boot-dm.git F: drivers/core/ +F: drivers/net/mdio/ F: include/dm/ F: test/dm/ diff --git a/doc/device-tree-bindings/net/mdio-bus.txt b/doc/device-tree-bindings/net/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/net/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..0e0982c 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -54,6 +54,8 @@ source "drivers/mtd/Kconfig" source "drivers/net/Kconfig" +source "drivers/net/mdio/Kconfig" + source "drivers/nvme/Kconfig" source "drivers/pci/Kconfig" diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 584bfdf..1cda03f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -70,3 +70,4 @@ obj-$(CONFIG_VSC9953) += vsc9953.o obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o obj-$(CONFIG_FSL_PFE) += pfe_eth/ +obj-$(CONFIG_MDIO) += mdio/ diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig new file mode 100644 index 000..533cc4a --- /dev/null +++ b/drivers/net/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config MDIO + bool "Enable MDIO(Management Data Input/Output) drivers" + depends on DM + help + Enable driver model for MDIO access. + Drivers provide methods to management data + Input/Output. + MDIO uclass provides interfaces
[U-Boot] [PATCH v3 0/2] Add MDIO driver model support
From: Ken Ma Changes in v3: - Move mdio uclass implementation to driver/net folder; - Replace flat-tree functions with livetree functions and update codes and comments to be consistent with driver-model codes style; - Put struct mii_dev to uclass platdata to avoid the mdio alloc and let driver model framework to alloc the memroy automatically, meanwhile the mii bus link initialization is added, - Move marvell mdio driver to driver/net/mdio folder; - Update codes according to mdio uclass implementation updates. Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS | 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/net/marvell-mdio.txt | 18 ++ doc/device-tree-bindings/net/mdio-bus.txt | 54 ++ drivers/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/mdio/Kconfig | 28 +++ drivers/net/mdio/Makefile | 7 + drivers/net/mdio/mdio-uclass.c| 112 drivers/net/mdio/mvmdio.c | 234 ++ include/dm/uclass-id.h| 1 + include/net/mdio.h| 62 +++ 12 files changed, 522 insertions(+) create mode 100644 doc/device-tree-bindings/net/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/net/mdio-bus.txt create mode 100644 drivers/net/mdio/Kconfig create mode 100644 drivers/net/mdio/Makefile create mode 100644 drivers/net/mdio/mdio-uclass.c create mode 100644 drivers/net/mdio/mvmdio.c create mode 100644 include/net/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/2] Add MDIO driver model support
From: Ken Ma Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS| 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ doc/device-tree-bindings/mdio/mdio-bus.txt | 54 ++ drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 28 +++ drivers/mdio/Makefile | 7 + drivers/mdio/mdio-uclass.c | 119 + drivers/mdio/mvmdio.c | 237 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 12 files changed, 532 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 drivers/mdio/mvmdio.c create mode 100644 include/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds evice tree binding for MDIO bus. Signed-off-by: Ken Ma --- Changes in v2: None MAINTAINERS| 1 + doc/device-tree-bindings/mdio/mdio-bus.txt | 54 + drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 18 + drivers/mdio/Makefile | 6 ++ drivers/mdio/mdio-uclass.c | 119 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 9 files changed, 264 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 include/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..f66a904 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -335,6 +335,7 @@ M: Simon Glass S: Maintained T: git git://git.denx.de/u-boot-dm.git F: drivers/core/ +F: drivers/mdio/ F: include/dm/ F: test/dm/ diff --git a/doc/device-tree-bindings/mdio/mdio-bus.txt b/doc/device-tree-bindings/mdio/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/mdio/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..3fc0a90 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -44,6 +44,8 @@ source "drivers/led/Kconfig" source "drivers/mailbox/Kconfig" +source "drivers/mdio/Kconfig" + source "drivers/memory/Kconfig" source "drivers/misc/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index a213ea9..041a7bf 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -82,6 +82,7 @@ obj-y += dfu/ obj-$(CONFIG_X86) += pch/ obj-y += phy/allwinner/ obj-y += phy/marvell/ +obj-y += mdio/ obj-y += rtc/ obj-y += scsi/ obj-y += sound/ diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig new file mode 100644 index 000..76e3758 --- /dev/null +++ b/drivers/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config DM_MDIO + bool "Enable Driver Model for MDIO drivers" + depends on DM + help + Enable driver model for MDIO access. + Drivers provide methods to management data + Input/Output. + MDIO uclass provides interfaces to get mdio + udevice or mii bus from its child phy node or + an ethernet udevice which the phy belongs to. + +endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile new file mode 100644 index 000..9b290c0 --- /dev/null +++ b/drivers/mdio/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018 Marvell International Ltd. +# Author: Ken Ma + +obj-$(CONFIG_DM_MDIO) += mdio-uclass.o diff --git a/drivers/mdio/mdio-uclass.c b/drivers/mdio/mdio-uclass.c new file mode 100644
[U-Boot] [PATCH v2 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma Reviewed-by: Chris Packham --- Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS| 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ drivers/mdio/Kconfig | 10 ++ drivers/mdio/Makefile | 1 + drivers/mdio/mvmdio.c | 237 + 6 files changed, 268 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 drivers/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index f66a904..fb58f17 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..aae4570 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select DM_MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/mdio/marvell-mdio.txt b/doc/device-tree-bindings/mdio/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/mdio/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig index 76e3758..ce251c5 100644 --- a/drivers/mdio/Kconfig +++ b/drivers/mdio/Kconfig @@ -15,4 +15,14 @@ config DM_MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on DM_MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile index 9b290c0..9f571aa 100644 --- a/drivers/mdio/Makefile +++ b/drivers/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_DM_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/mdio/mvmdio.c b/drivers/mdio/mvmdio.c new file mode 100644 index 000..2771d32 --- /dev/null +++ b/drivers/mdio/mvmdio.c @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION 0 +#define MVMDIO_SMI_READ_VALID BIT(27) +#define MVMDIO_SMI_BUSYBIT(28) + +#define MVMDIO_XSMI_MGNT_REG 0x0 +#define MVMDIO_XSMI_PHYADDR_SHIFT 16 +#define MVMDIO_XSMI_DEVADDR_SHIFT 21 +#define
[U-Boot] [PATCH v2 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma --- Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. MAINTAINERS| 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ drivers/mdio/Kconfig | 10 ++ drivers/mdio/Makefile | 1 + drivers/mdio/mvmdio.c | 237 + 6 files changed, 268 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 drivers/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index f66a904..fb58f17 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..aae4570 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select DM_MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/mdio/marvell-mdio.txt b/doc/device-tree-bindings/mdio/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/mdio/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig index 76e3758..ce251c5 100644 --- a/drivers/mdio/Kconfig +++ b/drivers/mdio/Kconfig @@ -15,4 +15,14 @@ config DM_MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on DM_MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile index 9b290c0..9f571aa 100644 --- a/drivers/mdio/Makefile +++ b/drivers/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_DM_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/mdio/mvmdio.c b/drivers/mdio/mvmdio.c new file mode 100644 index 000..2771d32 --- /dev/null +++ b/drivers/mdio/mvmdio.c @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION 0 +#define MVMDIO_SMI_READ_VALID BIT(27) +#define MVMDIO_SMI_BUSYBIT(28) + +#define MVMDIO_XSMI_MGNT_REG 0x0 +#define MVMDIO_XSMI_PHYADDR_SHIFT 16 +#define MVMDIO_XSMI_DEVADDR_SHIFT 21 +#define MVMDIO_XSMI_WRITE_OPERATION
[U-Boot] [PATCH v2 0/2] Add MDIO driver model support
From: Ken Ma Changes in v2: - Fix error printing: - Change some debug to pr_err; - mii bus has no parent member and it is not a udevice, so dev_err is changed to pr_err for mii bus error printings. Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS| 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ doc/device-tree-bindings/mdio/mdio-bus.txt | 54 ++ drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 28 +++ drivers/mdio/Makefile | 7 + drivers/mdio/mdio-uclass.c | 119 + drivers/mdio/mvmdio.c | 237 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 12 files changed, 532 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 drivers/mdio/mvmdio.c create mode 100644 include/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds evice tree binding for MDIO bus. Signed-off-by: Ken Ma --- Changes in v2: None MAINTAINERS| 1 + doc/device-tree-bindings/mdio/mdio-bus.txt | 54 + drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 18 + drivers/mdio/Makefile | 6 ++ drivers/mdio/mdio-uclass.c | 119 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 9 files changed, 264 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 include/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..f66a904 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -335,6 +335,7 @@ M: Simon Glass S: Maintained T: git git://git.denx.de/u-boot-dm.git F: drivers/core/ +F: drivers/mdio/ F: include/dm/ F: test/dm/ diff --git a/doc/device-tree-bindings/mdio/mdio-bus.txt b/doc/device-tree-bindings/mdio/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/mdio/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..3fc0a90 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -44,6 +44,8 @@ source "drivers/led/Kconfig" source "drivers/mailbox/Kconfig" +source "drivers/mdio/Kconfig" + source "drivers/memory/Kconfig" source "drivers/misc/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index a213ea9..041a7bf 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -82,6 +82,7 @@ obj-y += dfu/ obj-$(CONFIG_X86) += pch/ obj-y += phy/allwinner/ obj-y += phy/marvell/ +obj-y += mdio/ obj-y += rtc/ obj-y += scsi/ obj-y += sound/ diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig new file mode 100644 index 000..76e3758 --- /dev/null +++ b/drivers/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config DM_MDIO + bool "Enable Driver Model for MDIO drivers" + depends on DM + help + Enable driver model for MDIO access. + Drivers provide methods to management data + Input/Output. + MDIO uclass provides interfaces to get mdio + udevice or mii bus from its child phy node or + an ethernet udevice which the phy belongs to. + +endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile new file mode 100644 index 000..9b290c0 --- /dev/null +++ b/drivers/mdio/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018 Marvell International Ltd. +# Author: Ken Ma + +obj-$(CONFIG_DM_MDIO) += mdio-uclass.o diff --git a/drivers/mdio/mdio-uclass.c b/drivers/mdio/mdio-uclass.c new file mode 100644
[U-Boot] [PATCH 1/2] dm: mdio: add a uclass for MDIO
From: Ken Ma Add a uclass which provides access to MDIO busses and includes operations required by MDIO. The implementation is based on the existing mii/phy/mdio data structures and APIs. This patch also adds evice tree binding for MDIO bus. Signed-off-by: Ken Ma --- MAINTAINERS| 1 + doc/device-tree-bindings/mdio/mdio-bus.txt | 54 + drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 18 + drivers/mdio/Makefile | 6 ++ drivers/mdio/mdio-uclass.c | 119 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 9 files changed, 264 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 include/mdio.h diff --git a/MAINTAINERS b/MAINTAINERS index 642c448..f66a904 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -335,6 +335,7 @@ M: Simon Glass S: Maintained T: git git://git.denx.de/u-boot-dm.git F: drivers/core/ +F: drivers/mdio/ F: include/dm/ F: test/dm/ diff --git a/doc/device-tree-bindings/mdio/mdio-bus.txt b/doc/device-tree-bindings/mdio/mdio-bus.txt new file mode 100644 index 000..68d8b25 --- /dev/null +++ b/doc/device-tree-bindings/mdio/mdio-bus.txt @@ -0,0 +1,54 @@ +MDIO (Management Data Input/Output) busses + +MDIO busses can be described with a node for the MDIO master device +and a set of child nodes for each phy on the bus. + +The MDIO node requires the following properties: +- #address-cells - number of cells required to define phy address on +the MDIO bus. +- #size-cells - should be zero. +- compatible - name of MDIO bus controller following generic names +recommended practice. +- reg- address and length of the MDIO register. + +Optional property: +- mdio-name - MDIO bus name + +The child nodes of the MDIO driver are the individual PHY devices +connected to this MDIO bus. They must have a "reg" property given the +PHY address on the MDIO bus. +- reg - (required) phy address in MDIO bus. + +Example for cp110 MDIO node at the SoC level: + cp0_mdio: mdio@12a200 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,orion-mdio"; + reg = <0x12a200 0x10>; + mdio-name = "cp0-mdio"; + }; + + cp0_xmdio: mdio@12a600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "marvell,xmdio"; + reg = <0x12a600 0x200>; + mdio-name = "cp0-xmdio"; + }; + +And at the board level, example for armada-8040-mcbin board: + _mdio { + ge_phy: ethernet-phy@0 { + reg = <0>; + }; + }; + + _xmdio { + phy0: ethernet-phy@0 { + reg = <0>; + }; + + phy8: ethernet-phy@8 { + reg = <8>; + }; + }; diff --git a/drivers/Kconfig b/drivers/Kconfig index 9e21b28..3fc0a90 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -44,6 +44,8 @@ source "drivers/led/Kconfig" source "drivers/mailbox/Kconfig" +source "drivers/mdio/Kconfig" + source "drivers/memory/Kconfig" source "drivers/misc/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index a213ea9..041a7bf 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -82,6 +82,7 @@ obj-y += dfu/ obj-$(CONFIG_X86) += pch/ obj-y += phy/allwinner/ obj-y += phy/marvell/ +obj-y += mdio/ obj-y += rtc/ obj-y += scsi/ obj-y += sound/ diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig new file mode 100644 index 000..76e3758 --- /dev/null +++ b/drivers/mdio/Kconfig @@ -0,0 +1,18 @@ +# +# MDIO infrastructure and drivers +# + +menu "MDIO Support" + +config DM_MDIO + bool "Enable Driver Model for MDIO drivers" + depends on DM + help + Enable driver model for MDIO access. + Drivers provide methods to management data + Input/Output. + MDIO uclass provides interfaces to get mdio + udevice or mii bus from its child phy node or + an ethernet udevice which the phy belongs to. + +endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile new file mode 100644 index 000..9b290c0 --- /dev/null +++ b/drivers/mdio/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018 Marvell International Ltd. +# Author: Ken Ma + +obj-$(CONFIG_DM_MDIO) += mdio-uclass.o diff --git a/drivers/mdio/mdio-uclass.c b/drivers/mdio/mdio-uclass.c new file mode 100644 index 000..251776b
[U-Boot] [PATCH 2/2] mdio: add marvell MDIO driver
From: Ken Ma This patch adds a separate driver for the MDIO interface of the Marvell Ethernet controllers based on driver model. There are two reasons to have a separate driver rather than including it inside the MAC driver itself: *) The MDIO interface is shared by all Ethernet ports, so a driver must guarantee non-concurrent accesses to this MDIO interface. The most logical way is to have a separate driver that handles this single MDIO interface, used by all Ethernet ports. *) The MDIO interface is the same between the existing mv643xx_eth driver and the new mvneta/mvpp2 driver. Even though it is for now only used by the mvneta/mvpp2 driver, it will in the future be used by the mv643xx_eth driver as well. This driver supports SMI IEEE for 802.3 Clause 22 and XSMI for IEEE 802.3 Clause 45. This patch also adds device tree binding for marvell MDIO driver. Signed-off-by: Ken Ma --- MAINTAINERS| 1 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ drivers/mdio/Kconfig | 10 ++ drivers/mdio/Makefile | 1 + drivers/mdio/mvmdio.c | 237 + 6 files changed, 268 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 drivers/mdio/mvmdio.c diff --git a/MAINTAINERS b/MAINTAINERS index f66a904..fb58f17 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -137,6 +137,7 @@ T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ F: drivers/ata/ahci_mvebu.c +F: drivers/mdio/mvmdio.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422b..aae4570 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -432,6 +432,7 @@ config ARCH_MVEBU select DM_SPI select DM_SPI_FLASH select SPI + select DM_MDIO config TARGET_DEVKIT3250 bool "Support devkit3250" diff --git a/doc/device-tree-bindings/mdio/marvell-mdio.txt b/doc/device-tree-bindings/mdio/marvell-mdio.txt new file mode 100644 index 000..55db435 --- /dev/null +++ b/doc/device-tree-bindings/mdio/marvell-mdio.txt @@ -0,0 +1,18 @@ +* Marvell MDIO Ethernet Controller interface + +The Ethernet controllers of the Marvel Armada 3700 and Armada 7k/8k +have an identical unit that provides an interface with the MDIO bus. +This driver handles this MDIO interface. + +Mandatory properties: +SoC specific: + - #address-cells: Must be <1>. + - #size-cells: Must be <0>. + - compatible: Should be "marvell,orion-mdio" (for SMI) + "marvell,xmdio" (for XSMI) + - reg: Base address and size SMI/XMSI bus. + +Optional properties: + - mdio-name - MDIO bus name + +For example, please refer to "mdio-bus.txt". diff --git a/drivers/mdio/Kconfig b/drivers/mdio/Kconfig index 76e3758..ce251c5 100644 --- a/drivers/mdio/Kconfig +++ b/drivers/mdio/Kconfig @@ -15,4 +15,14 @@ config DM_MDIO udevice or mii bus from its child phy node or an ethernet udevice which the phy belongs to. +config MVMDIO + bool "Marvell MDIO interface support" + depends on DM_MDIO + select PHYLIB + help + This driver supports the MDIO interface found in the network + interface units of the Marvell EBU SoCs (Kirkwood, Orion5x, + Dove, Armada 370, Armada XP, Armada 37xx and Armada7K/8K/8KP). + + This driver is used by the MVPP2 and MVNETA drivers. endmenu diff --git a/drivers/mdio/Makefile b/drivers/mdio/Makefile index 9b290c0..9f571aa 100644 --- a/drivers/mdio/Makefile +++ b/drivers/mdio/Makefile @@ -4,3 +4,4 @@ # Author: Ken Ma obj-$(CONFIG_DM_MDIO) += mdio-uclass.o +obj-$(CONFIG_MVMDIO) += mvmdio.o diff --git a/drivers/mdio/mvmdio.c b/drivers/mdio/mvmdio.c new file mode 100644 index 000..b2c6636 --- /dev/null +++ b/drivers/mdio/mvmdio.c @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Author: Ken Ma + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define MVMDIO_SMI_DATA_SHIFT 0 +#define MVMDIO_SMI_PHY_ADDR_SHIFT 16 +#define MVMDIO_SMI_PHY_REG_SHIFT 21 +#define MVMDIO_SMI_READ_OPERATION BIT(26) +#define MVMDIO_SMI_WRITE_OPERATION 0 +#define MVMDIO_SMI_READ_VALID BIT(27) +#define MVMDIO_SMI_BUSYBIT(28) + +#define MVMDIO_XSMI_MGNT_REG 0x0 +#define MVMDIO_XSMI_PHYADDR_SHIFT 16 +#define MVMDIO_XSMI_DEVADDR_SHIFT 21 +#define MVMDIO_XSMI_WRITE_OPERATION(0x5 << 26) +#define MVMDIO_XSMI_READ_OPERATION (0x7 << 26) +#define MVMDIO_XSMI_READ_VALID BIT(29) +#define MVMDIO_XSMI_BUSY BIT(30) +#define MVMDIO_XSMI_ADDR_REG
[U-Boot] [PATCH 0/2] Add MDIO driver model support
From: Ken Ma Ken Ma (2): dm: mdio: add a uclass for MDIO mdio: add marvell MDIO driver MAINTAINERS| 2 + arch/arm/Kconfig | 1 + doc/device-tree-bindings/mdio/marvell-mdio.txt | 18 ++ doc/device-tree-bindings/mdio/mdio-bus.txt | 54 ++ drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/mdio/Kconfig | 28 +++ drivers/mdio/Makefile | 7 + drivers/mdio/mdio-uclass.c | 119 + drivers/mdio/mvmdio.c | 237 + include/dm/uclass-id.h | 1 + include/mdio.h | 62 +++ 12 files changed, 532 insertions(+) create mode 100644 doc/device-tree-bindings/mdio/marvell-mdio.txt create mode 100644 doc/device-tree-bindings/mdio/mdio-bus.txt create mode 100644 drivers/mdio/Kconfig create mode 100644 drivers/mdio/Makefile create mode 100644 drivers/mdio/mdio-uclass.c create mode 100644 drivers/mdio/mvmdio.c create mode 100644 include/mdio.h -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory
From: Ken MaCurrently mvebu sata driver is in arch/arm/mach_mvebu directory, this patch moves it to drivers/ata directory with renaming "sata.c" to "ahci_mvebu.c" which is aligned to Linux. New ahci driver's kconfig option is added as AHCI_MVEBU which selects SCSI_AHCI and is based on AHCI. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v4: - Base on the latest mainline git version - Let AHCI_MVEBU depend on AHCI and select SCSI_AHCI ahci_mvebu driver is based on AHCI UCLASS, so let AHCI_MVEBU based on AHCI; and this driver uses ahci_init() in ahci.c, so let it select SCSI_AHCI. In this patch, DM_SCSI is not selected and it will be selected in the later patch which adds scsi support by creating a SCSI device as a child of mvebu ahci device. Changes in v3: - Use the new SPDX tags Changes in v2: - Add MAINTAINERS updating MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - drivers/ata/Kconfig| 10 ++ drivers/ata/Makefile | 1 + arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 0 5 files changed, 12 insertions(+), 1 deletion(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 5670917..cd40dbd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -135,6 +135,7 @@ S: Maintained T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ +F: drivers/ata/ahci_mvebu.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 3b9a811..ade7b87 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -7,7 +7,6 @@ ifdef CONFIG_ARM64 obj-$(CONFIG_ARMADA_3700) += armada3700/ obj-$(CONFIG_ARMADA_8K) += armada8k/ obj-y += arm64-common.o -obj-$(CONFIG_AHCI) += sata.o else # CONFIG_ARM64 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 86ec628..36e1748 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,4 +99,14 @@ config SATA_SIL3114 help Enable this driver to support the SIL3114 SATA controllers. +config AHCI_MVEBU + bool "Marvell EBU AHCI SATA support" + depends on ARCH_MVEBU + depends on AHCI + select SCSI_AHCI + help + This option enables support for the Marvell EBU SoC's + onboard AHCI SATA. + + If unsure, say N. endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 02f02c8..10bed53 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -17,3 +17,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_SANDBOX) += sata_sandbox.o +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c similarity index 100% rename from arch/arm/mach-mvebu/sata.c rename to drivers/ata/ahci_mvebu.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 0/4] ahci mvebu driver updates
From: Ken MaThese patches move ahci mvebu driver to drivers/ata directory with bug fixing and scsi supporting. Changes in v4: - Base on the latest mainline git version - Let AHCI_MVEBU depend on AHCI and select SCSI_AHCI ahci_mvebu driver is based on AHCI UCLASS, so let AHCI_MVEBU based on AHCI; and this driver uses ahci_init() in ahci.c, so let it select SCSI_AHCI. In this patch, DM_SCSI is not selected and it will be selected in the later patch which adds scsi support by creating a SCSI device as a child of mvebu ahci device. - Let AHCI_MVEBU select DM_SCSI This patch adds scsi support by creating a SCSI device as a child of mvebu ahci device; the functions of creating SCSI device need the kconfig option DM_SCSI, so let AHCI_MVEBU select DM_SCSI. - Remove CONFIG_AHCI_MVEBU from marvell arm64 default config files Since AHCI_MVEBU selects SCSI_AHCI and it is added into marvell arm64 default config files, so CONFIG_SCSI_AHCI is removed. Changes in v3: - Use the new SPDX tags Changes in v2: - Add MAINTAINERS updating David Sniatkiwicz (1): ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds Ken Ma (3): ata: mvebu: move mvebu sata driver to drivers/ata directory ata: ahci_mvebu: add scsi support arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU MAINTAINERS | 1 + arch/arm/mach-mvebu/Makefile | 1 - configs/mvebu_db-88f3720_defconfig| 2 +- configs/mvebu_db_armada8k_defconfig | 2 +- configs/mvebu_espressobin-88f3720_defconfig | 2 +- configs/mvebu_mcbin-88f8040_defconfig | 2 +- drivers/ata/Kconfig | 11 +++ drivers/ata/Makefile | 1 + .../arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 19 +-- 9 files changed, 30 insertions(+), 11 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (71%) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/4] ata: ahci_mvebu: add scsi support
From: Ken MaMvebu AHCI is AHCI driver which uses SCSI under the hood. This patch adjusts AHCI setup to support SCSI by creating a SCSI device as a child. Since the functions of creating SCSI device need the kconfig option DM_SCSI, so let AHCI_MVEBU select DM_SCSI. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v4: - Let AHCI_MVEBU select DM_SCSI This patch adds scsi support by creating a SCSI device as a child of mvebu ahci device; the functions of creating SCSI device need the kconfig option DM_SCSI, so let AHCI_MVEBU select DM_SCSI. Changes in v3: None Changes in v2: None drivers/ata/Kconfig | 1 + drivers/ata/ahci_mvebu.c | 17 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 36e1748..49a056e 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -104,6 +104,7 @@ config AHCI_MVEBU depends on ARCH_MVEBU depends on AHCI select SCSI_AHCI + select DM_SCSI help This option enables support for the Marvell EBU SoC's onboard AHCI SATA. diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index c1d215f..6e3f17e 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,6 +16,20 @@ __weak int board_ahci_enable(void) return 0; } +static int mvebu_ahci_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + int ret; + + ret = ahci_bind_scsi(dev, _dev); + if (ret) { + debug("%s: Failed to bind (err=%d\n)", __func__, ret); + return ret; + } + + return 0; +} + static int mvebu_ahci_probe(struct udevice *dev) { /* @@ -24,7 +38,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_init(devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0; } @@ -39,5 +53,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = { .name = "ahci_mvebu", .id = UCLASS_AHCI, .of_match = mvebu_ahci_ids, + .bind = mvebu_ahci_bind, .probe = mvebu_ahci_probe, }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU
From: Ken MaThis patch enables the new ahci mvebu driver for marvell arm64 platform SOCs(A3k and A8k). And since AHCI_MVEBU selects SCSI_AHCI, so "CONFIG_SCSI_AHCI=y" is removed from those default config files. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v4: - Remove CONFIG_AHCI_MVEBU from marvell arm64 default config files Since AHCI_MVEBU selects SCSI_AHCI and it is added into marvell arm64 default config files, so CONFIG_SCSI_AHCI is removed. Changes in v3: None Changes in v2: None configs/mvebu_db-88f3720_defconfig | 2 +- configs/mvebu_db_armada8k_defconfig | 2 +- configs/mvebu_espressobin-88f3720_defconfig | 2 +- configs/mvebu_mcbin-88f8040_defconfig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index e6f7cb9..4ba287f 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y # CONFIG_MVEBU_GPIO is not set diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index 63f2103..b7694ec 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 5a6d1e6..db11e51 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index de682d1..545bb4f 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -32,7 +32,7 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds
From: David SniatkiwiczThis workaround was added for A8040/7040 A0. A8040/7040 A0 is no longer supported so this workaround can be removed. Signed-off-by: David Sniatkiwicz Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/ata/ahci_mvebu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 3ae8dae..c1d215f 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,14 +16,6 @@ __weak int board_ahci_enable(void) return 0; } -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - static int mvebu_ahci_probe(struct udevice *dev) { /* -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory
From: Ken MaCurrently mvebu sata driver is in arch/arm/mach_mvebu directory, this patch moves it to drivers/ata directory with renaming "sata.c" to "ahci_mvebu.c" which is aligned to Linux. New ahci driver's kconfig option is added as AHCI_MVEBU which selects SCSI_AHCI and is based on AHCI. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass ahci_mvebu driver is based on AHCI UCLASS, so let AHCI_MVEBU based on AHCI; and this driver uses ahci_init() in ahci.c, so let it select SCSI_AHCI. In this patch, DM_SCSI is not selected and it will be selected in the later patch which adds scsi support by creating a SCSI device as a child of mvebu ahci device. --- Changes in v4: - Base on the latest mainline git version - Let AHCI_MVEBU depend on AHCI and select SCSI_AHCI Changes in v3: - Use the new SPDX tags Changes in v2: - Add MAINTAINERS updating MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - drivers/ata/Kconfig| 10 ++ drivers/ata/Makefile | 1 + arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 0 5 files changed, 12 insertions(+), 1 deletion(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 5670917..cd40dbd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -135,6 +135,7 @@ S: Maintained T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ +F: drivers/ata/ahci_mvebu.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 3b9a811..ade7b87 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -7,7 +7,6 @@ ifdef CONFIG_ARM64 obj-$(CONFIG_ARMADA_3700) += armada3700/ obj-$(CONFIG_ARMADA_8K) += armada8k/ obj-y += arm64-common.o -obj-$(CONFIG_AHCI) += sata.o else # CONFIG_ARM64 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 86ec628..36e1748 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,4 +99,14 @@ config SATA_SIL3114 help Enable this driver to support the SIL3114 SATA controllers. +config AHCI_MVEBU + bool "Marvell EBU AHCI SATA support" + depends on ARCH_MVEBU + depends on AHCI + select SCSI_AHCI + help + This option enables support for the Marvell EBU SoC's + onboard AHCI SATA. + + If unsure, say N. endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 02f02c8..10bed53 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -17,3 +17,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_SANDBOX) += sata_sandbox.o +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c similarity index 100% rename from arch/arm/mach-mvebu/sata.c rename to drivers/ata/ahci_mvebu.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 0/4] ahci mvebu driver updates
From: Ken MaThese patches move ahci mvebu driver to drivers/ata directory with bug fixing and scsi supporting. Changes in v4: - Base on the latest mainline git version - Let AHCI_MVEBU depend on AHCI and select SCSI_AHCI - Let AHCI_MVEBU select DM_SCSI - Remove CONFIG_AHCI_MVEBU from marvell arm64 default config files Changes in v3: - Use the new SPDX tags Changes in v2: - Add MAINTAINERS updating David Sniatkiwicz (1): ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds Ken Ma (3): ata: mvebu: move mvebu sata driver to drivers/ata directory ata: ahci_mvebu: add scsi support arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU MAINTAINERS | 1 + arch/arm/mach-mvebu/Makefile | 1 - configs/mvebu_db-88f3720_defconfig| 2 +- configs/mvebu_db_armada8k_defconfig | 2 +- configs/mvebu_espressobin-88f3720_defconfig | 2 +- configs/mvebu_mcbin-88f8040_defconfig | 2 +- drivers/ata/Kconfig | 11 +++ drivers/ata/Makefile | 1 + .../arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 19 +-- 9 files changed, 30 insertions(+), 11 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (71%) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU
From: Ken MaThis patch enables the new ahci mvebu driver for marvell arm64 platform SOCs(A3k and A8k). And since AHCI_MVEBU selects SCSI_AHCI, so "CONFIG_SCSI_AHCI=y" is removed from those default config files. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass Since AHCI_MVEBU selects SCSI_AHCI and it is added into marvell arm64 default config files, so CONFIG_SCSI_AHCI is removed. --- Changes in v4: - Remove CONFIG_AHCI_MVEBU from marvell arm64 default config files Changes in v3: None Changes in v2: None configs/mvebu_db-88f3720_defconfig | 2 +- configs/mvebu_db_armada8k_defconfig | 2 +- configs/mvebu_espressobin-88f3720_defconfig | 2 +- configs/mvebu_mcbin-88f8040_defconfig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index e6f7cb9..4ba287f 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y # CONFIG_MVEBU_GPIO is not set diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index 63f2103..b7694ec 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 5a6d1e6..db11e51 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -30,7 +30,7 @@ CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index de682d1..545bb4f 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -32,7 +32,7 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/4] ata: ahci_mvebu: add scsi support
From: Ken MaMvebu AHCI is AHCI driver which uses SCSI under the hood. This patch adjusts AHCI setup to support SCSI by creating a SCSI device as a child. Since the functions of creating SCSI device need the kconfig option DM_SCSI, so let AHCI_MVEBU select DM_SCSI. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass This patch adds scsi support by creating a SCSI device as a child of mvebu ahci device; the functions of creating SCSI device need the kconfig option DM_SCSI, so let AHCI_MVEBU select DM_SCSI. --- Changes in v4: - Let AHCI_MVEBU select DM_SCSI Changes in v3: None Changes in v2: None drivers/ata/Kconfig | 1 + drivers/ata/ahci_mvebu.c | 17 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 36e1748..49a056e 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -104,6 +104,7 @@ config AHCI_MVEBU depends on ARCH_MVEBU depends on AHCI select SCSI_AHCI + select DM_SCSI help This option enables support for the Marvell EBU SoC's onboard AHCI SATA. diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index c1d215f..6e3f17e 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,6 +16,20 @@ __weak int board_ahci_enable(void) return 0; } +static int mvebu_ahci_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + int ret; + + ret = ahci_bind_scsi(dev, _dev); + if (ret) { + debug("%s: Failed to bind (err=%d\n)", __func__, ret); + return ret; + } + + return 0; +} + static int mvebu_ahci_probe(struct udevice *dev) { /* @@ -24,7 +38,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_init(devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0; } @@ -39,5 +53,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = { .name = "ahci_mvebu", .id = UCLASS_AHCI, .of_match = mvebu_ahci_ids, + .bind = mvebu_ahci_bind, .probe = mvebu_ahci_probe, }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds
From: David SniatkiwiczThis workaround was added for A8040/7040 A0. A8040/7040 A0 is no longer supported so this workaround can be removed. Signed-off-by: David Sniatkiwicz Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/ata/ahci_mvebu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 3ae8dae..c1d215f 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,14 +16,6 @@ __weak int board_ahci_enable(void) return 0; } -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - static int mvebu_ahci_probe(struct udevice *dev) { /* -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 0/4] ahci mvebu driver updates
From: Ken MaThese patches move ahci mvebu driver to drivers/ata directory with bug fixing and scsi supporting. Changes in v3: - Use the new SPDX tags. David Sniatkiwicz (1): ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds Ken Ma (3): ata: mvebu: move mvebu sata driver to drivers/ata directory ata: ahci_mvebu: add scsi support arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig| 1 + configs/mvebu_espressobin-88f3720_defconfig| 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + drivers/ata/Kconfig| 9 drivers/ata/Makefile | 1 + .../mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 24 +- 9 files changed, 29 insertions(+), 11 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (68%) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU
From: Ken MaThis patch enables the new ahci mvebu driver for marvell arm64 platform SOCs(A3k and A8k). Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v3: None configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 1d6233a..d40dd42 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y # CONFIG_MVEBU_GPIO is not set diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index da67aad..72c86f3 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -30,6 +30,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 314d405..cc41711 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_MISC=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index e16a56e..dea0cd0 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory
From: Ken MaCurrently mvebu sata driver is in arch/arm/mach_mvebu directory, this patch moves it to drivers/ata directory with renaming "sata.c" to "ahci_mvebu.c" which is aligned to Linux. New ahci driver's kconfig option is added as AHCI_MVEBU which selects DM_SCSI. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v3: - Use the new SPDX tags. MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - drivers/ata/Kconfig| 9 + drivers/ata/Makefile | 1 + arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 5 + 5 files changed, 12 insertions(+), 5 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (93%) diff --git a/MAINTAINERS b/MAINTAINERS index 077828c..97c0752 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -134,6 +134,7 @@ S: Maintained T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ +F: drivers/ata/ahci_mvebu.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index d4210af..7f0d692 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -9,7 +9,6 @@ ifdef CONFIG_ARM64 obj-$(CONFIG_ARMADA_3700) += armada3700/ obj-$(CONFIG_ARMADA_8K) += armada8k/ obj-y += arm64-common.o -obj-y += sata.o else # CONFIG_ARM64 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 86ec628..9ef4589 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,4 +99,13 @@ config SATA_SIL3114 help Enable this driver to support the SIL3114 SATA controllers. +config AHCI_MVEBU + bool "Marvell EBU AHCI SATA support" + depends on ARCH_MVEBU + select DM_SCSI + help + This option enables support for the Marvell EBU SoC's + onboard AHCI SATA. + + If unsure, say N. endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index a94c804..0254640 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_SANDBOX) += sata_sandbox.o +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c similarity index 93% rename from arch/arm/mach-mvebu/sata.c rename to drivers/ata/ahci_mvebu.c index 5d8032b..3ae8dae 100644 --- a/arch/arm/mach-mvebu/sata.c +++ b/drivers/ata/ahci_mvebu.c @@ -1,15 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2016 Stefan Roese - * - * SPDX-License-Identifier:GPL-2.0+ */ #include #include #include -DECLARE_GLOBAL_DATA_PTR; - /* * Dummy implementation that can be overwritten by a board * specific function -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 3/4] ata: ahci_mvebu: add scsi support
From: Ken MaMvebu AHCI is AHCI driver which uses SCSI under the hood. This patch adjusts AHCI setup to support SCSI by creating a SCSI device as a child. Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v3: None drivers/ata/ahci_mvebu.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index c1d215f..6e3f17e 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,6 +16,20 @@ __weak int board_ahci_enable(void) return 0; } +static int mvebu_ahci_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + int ret; + + ret = ahci_bind_scsi(dev, _dev); + if (ret) { + debug("%s: Failed to bind (err=%d\n)", __func__, ret); + return ret; + } + + return 0; +} + static int mvebu_ahci_probe(struct udevice *dev) { /* @@ -24,7 +38,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_init(devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0; } @@ -39,5 +53,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = { .name = "ahci_mvebu", .id = UCLASS_AHCI, .of_match = mvebu_ahci_ids, + .bind = mvebu_ahci_bind, .probe = mvebu_ahci_probe, }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds
From: David SniatkiwiczThis workaround was added for A8040/7040 A0. A8040/7040 A0 is no longer supported so this workaround can be removed. Signed-off-by: David Sniatkiwicz Signed-off-by: Ken Ma Reviewed-by: Stefan Roese Reviewed-by: Simon Glass --- Changes in v3: None drivers/ata/ahci_mvebu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 3ae8dae..c1d215f 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -16,14 +16,6 @@ __weak int board_ahci_enable(void) return 0; } -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - static int mvebu_ahci_probe(struct udevice *dev) { /* -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory
From: Ken MaCurrently mvebu sata driver is in arch/arm/mach_mvebu directory, this patch moves it to drivers/ata directory with renaming "sata.c" to "ahci_mvebu.c" which is aligned to Linux. New ahci driver's kconfig option is added as AHCI_MVEBU which selects DM_SCSI. Signed-off-by: Ken Ma --- Changes in v2: - Add MAINTAINERS updating MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - drivers/ata/Kconfig| 9 + drivers/ata/Makefile | 1 + arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 6 +++--- 5 files changed, 14 insertions(+), 4 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (89%) diff --git a/MAINTAINERS b/MAINTAINERS index 077828c..97c0752 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -134,6 +134,7 @@ S: Maintained T: git git://git.denx.de/u-boot-marvell.git F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mvebu/ +F: drivers/ata/ahci_mvebu.c ARM MARVELL PXA M: Marek Vasut diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index d4210af..7f0d692 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -9,7 +9,6 @@ ifdef CONFIG_ARM64 obj-$(CONFIG_ARMADA_3700) += armada3700/ obj-$(CONFIG_ARMADA_8K) += armada8k/ obj-y += arm64-common.o -obj-y += sata.o else # CONFIG_ARM64 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 86ec628..9ef4589 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,4 +99,13 @@ config SATA_SIL3114 help Enable this driver to support the SIL3114 SATA controllers. +config AHCI_MVEBU + bool "Marvell EBU AHCI SATA support" + depends on ARCH_MVEBU + select DM_SCSI + help + This option enables support for the Marvell EBU SoC's + onboard AHCI SATA. + + If unsure, say N. endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index a94c804..0254640 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_SANDBOX) += sata_sandbox.o +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o diff --git a/arch/arm/mach-mvebu/sata.c b/drivers/ata/ahci_mvebu.c similarity index 89% rename from arch/arm/mach-mvebu/sata.c rename to drivers/ata/ahci_mvebu.c index 5d8032b..5c1b293 100644 --- a/arch/arm/mach-mvebu/sata.c +++ b/drivers/ata/ahci_mvebu.c @@ -1,15 +1,15 @@ /* + * Copyright (C) 2018 Marvell International Ltd. * Copyright (C) 2016 Stefan Roese * - * SPDX-License-Identifier:GPL-2.0+ + * SPDX-License-Identifier: GPL-2.0+ + * https://spdx.org/licenses */ #include #include #include -DECLARE_GLOBAL_DATA_PTR; - /* * Dummy implementation that can be overwritten by a board * specific function -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] ahci mvebu driver updates
From: Ken MaThese patches move ahci mvebu driver to drivers/ata directory with bug fixing and scsi supporting. Changes in v2: - Add MAINTAINERS updating David Sniatkiwicz (1): ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds Ken Ma (3): ata: mvebu: move mvebu sata driver to drivers/ata directory ata: ahci_mvebu: add scsi support arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU MAINTAINERS| 1 + arch/arm/mach-mvebu/Makefile | 1 - configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig| 1 + configs/mvebu_espressobin-88f3720_defconfig| 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + drivers/ata/Kconfig| 9 drivers/ata/Makefile | 1 + .../mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c | 25 ++ 9 files changed, 31 insertions(+), 10 deletions(-) rename arch/arm/mach-mvebu/sata.c => drivers/ata/ahci_mvebu.c (63%) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU
From: Ken MaThis patch enables the new ahci mvebu driver for marvell arm64 platform SOCs(A3k and A8k). Signed-off-by: Ken Ma --- Changes in v2: None configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 1d6233a..d40dd42 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y # CONFIG_MVEBU_GPIO is not set diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index da67aad..72c86f3 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -30,6 +30,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 314d405..cc41711 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_MISC=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index e16a56e..dea0cd0 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/4] ata: ahci_mvebu: add scsi support
From: Ken MaMvebu AHCI is AHCI driver which uses SCSI under the hood. This patch adjusts AHCI setup to support SCSI by creating a SCSI device as a child. Signed-off-by: Ken Ma --- Changes in v2: None drivers/ata/ahci_mvebu.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 97a04d9..9041a72 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -19,6 +19,20 @@ __weak int board_ahci_enable(void) return 0; } +static int mvebu_ahci_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + int ret; + + ret = ahci_bind_scsi(dev, _dev); + if (ret) { + debug("%s: Failed to bind (err=%d\n)", __func__, ret); + return ret; + } + + return 0; +} + static int mvebu_ahci_probe(struct udevice *dev) { /* @@ -27,7 +41,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_init(devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0; } @@ -42,5 +56,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = { .name = "ahci_mvebu", .id = UCLASS_AHCI, .of_match = mvebu_ahci_ids, + .bind = mvebu_ahci_bind, .probe = mvebu_ahci_probe, }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds
From: David SniatkiwiczThis workaround was added for A8040/7040 A0. A8040/7040 A0 is no longer supported so this workaround can be removed. Signed-off-by: David Sniatkiwicz Signed-off-by: Ken Ma --- Changes in v2: None drivers/ata/ahci_mvebu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 5c1b293..97a04d9 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -19,14 +19,6 @@ __weak int board_ahci_enable(void) return 0; } -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - static int mvebu_ahci_probe(struct udevice *dev) { /* -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory
From: Ken MaCurrently mvebu sata driver is in arch/arm/mach_mvebu directory, this patch moves it to drivers/ata directory with renaming "sata.c" to "ahci_mvebu.c" which is aligned to Linux. New ahci driver's kconfig option is added as AHCI_MVEBU which selects DM_SCSI. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese --- arch/arm/mach-mvebu/Makefile | 1 - arch/arm/mach-mvebu/sata.c | 54 drivers/ata/Kconfig | 9 drivers/ata/Makefile | 1 + drivers/ata/ahci_mvebu.c | 54 5 files changed, 64 insertions(+), 55 deletions(-) delete mode 100644 arch/arm/mach-mvebu/sata.c create mode 100644 drivers/ata/ahci_mvebu.c diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index d4210af..7f0d692 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -9,7 +9,6 @@ ifdef CONFIG_ARM64 obj-$(CONFIG_ARMADA_3700) += armada3700/ obj-$(CONFIG_ARMADA_8K) += armada8k/ obj-y += arm64-common.o -obj-y += sata.o else # CONFIG_ARM64 diff --git a/arch/arm/mach-mvebu/sata.c b/arch/arm/mach-mvebu/sata.c deleted file mode 100644 index 5d8032b..000 --- a/arch/arm/mach-mvebu/sata.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2016 Stefan Roese - * - * SPDX-License-Identifier:GPL-2.0+ - */ - -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -/* - * Dummy implementation that can be overwritten by a board - * specific function - */ -__weak int board_ahci_enable(void) -{ - return 0; -} - -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - -static int mvebu_ahci_probe(struct udevice *dev) -{ - /* -* Board specific SATA / AHCI enable code, e.g. enable the -* AHCI power or deassert reset -*/ - board_ahci_enable(); - - ahci_init(devfdt_get_addr_ptr(dev)); - - return 0; -} - -static const struct udevice_id mvebu_ahci_ids[] = { - { .compatible = "marvell,armada-3700-ahci" }, - { .compatible = "marvell,armada-8k-ahci" }, - { } -}; - -U_BOOT_DRIVER(ahci_mvebu_drv) = { - .name = "ahci_mvebu", - .id = UCLASS_AHCI, - .of_match = mvebu_ahci_ids, - .probe = mvebu_ahci_probe, -}; diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 86ec628..9ef4589 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -99,4 +99,13 @@ config SATA_SIL3114 help Enable this driver to support the SIL3114 SATA controllers. +config AHCI_MVEBU + bool "Marvell EBU AHCI SATA support" + depends on ARCH_MVEBU + select DM_SCSI + help + This option enables support for the Marvell EBU SoC's + onboard AHCI SATA. + + If unsure, say N. endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index a94c804..0254640 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_SANDBOX) += sata_sandbox.o +obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c new file mode 100644 index 000..5c1b293 --- /dev/null +++ b/drivers/ata/ahci_mvebu.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 Marvell International Ltd. + * Copyright (C) 2016 Stefan Roese + * + * SPDX-License-Identifier: GPL-2.0+ + * https://spdx.org/licenses + */ + +#include +#include +#include + +/* + * Dummy implementation that can be overwritten by a board + * specific function + */ +__weak int board_ahci_enable(void) +{ + return 0; +} + +#ifdef CONFIG_ARMADA_8K +/* CP110 has different AHCI port addresses */ +void __iomem *ahci_port_base(void __iomem *base, u32 port) +{ + return base + 0x1 + (port * 0x1); +} +#endif + +static int mvebu_ahci_probe(struct udevice *dev) +{ + /* +* Board specific SATA / AHCI enable code, e.g. enable the +* AHCI power or deassert reset +*/ + board_ahci_enable(); + + ahci_init(devfdt_get_addr_ptr(dev)); + + return 0; +} + +static const struct udevice_id mvebu_ahci_ids[] = { + { .compatible = "marvell,armada-3700-ahci" }, + { .compatible = "marvell,armada-8k-ahci" }, + { } +}; + +U_BOOT_DRIVER(ahci_mvebu_drv) = { + .name = "ahci_mvebu", + .id = UCLASS_AHCI, + .of_match = mvebu_ahci_ids, + .probe = mvebu_ahci_probe, +}; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU
From: Ken MaThis patch enables the new ahci mvebu driver for marvell arm64 platform SOCs(A3k and A8k). Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese --- configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 1d6233a..d40dd42 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y # CONFIG_MVEBU_GPIO is not set diff --git a/configs/mvebu_db_armada8k_defconfig b/configs/mvebu_db_armada8k_defconfig index da67aad..72c86f3 100644 --- a/configs/mvebu_db_armada8k_defconfig +++ b/configs/mvebu_db_armada8k_defconfig @@ -30,6 +30,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 314d405..cc41711 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -28,6 +28,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_MISC=y diff --git a/configs/mvebu_mcbin-88f8040_defconfig b/configs/mvebu_mcbin-88f8040_defconfig index e16a56e..dea0cd0 100644 --- a/configs/mvebu_mcbin-88f8040_defconfig +++ b/configs/mvebu_mcbin-88f8040_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y +CONFIG_AHCI_MVEBU=y CONFIG_BLOCK_CACHE=y CONFIG_DM_GPIO=y CONFIG_DM_I2C=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds
From: David SniatkiwiczThis workaround was added for A8040/7040 A0. A8040/7040 A0 is no longer supported so this workaround can be removed. Signed-off-by: David Sniatkiwicz Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese --- drivers/ata/ahci_mvebu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 5c1b293..97a04d9 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -19,14 +19,6 @@ __weak int board_ahci_enable(void) return 0; } -#ifdef CONFIG_ARMADA_8K -/* CP110 has different AHCI port addresses */ -void __iomem *ahci_port_base(void __iomem *base, u32 port) -{ - return base + 0x1 + (port * 0x1); -} -#endif - static int mvebu_ahci_probe(struct udevice *dev) { /* -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/4] ata: ahci_mvebu: add scsi support
From: Ken MaMvebu AHCI is AHCI driver which uses SCSI under the hood. This patch adjusts AHCI setup to support SCSI by creating a SCSI device as a child. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese --- drivers/ata/ahci_mvebu.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 97a04d9..9041a72 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -19,6 +19,20 @@ __weak int board_ahci_enable(void) return 0; } +static int mvebu_ahci_bind(struct udevice *dev) +{ + struct udevice *scsi_dev; + int ret; + + ret = ahci_bind_scsi(dev, _dev); + if (ret) { + debug("%s: Failed to bind (err=%d\n)", __func__, ret); + return ret; + } + + return 0; +} + static int mvebu_ahci_probe(struct udevice *dev) { /* @@ -27,7 +41,7 @@ static int mvebu_ahci_probe(struct udevice *dev) */ board_ahci_enable(); - ahci_init(devfdt_get_addr_ptr(dev)); + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0; } @@ -42,5 +56,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = { .name = "ahci_mvebu", .id = UCLASS_AHCI, .of_match = mvebu_ahci_ids, + .bind = mvebu_ahci_bind, .probe = mvebu_ahci_probe, }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/4] ahci mvebu driver updates
From: Ken MaThese patches move ahci mvebu driver to drivers/ata directory with bug fixing and scsi supporting. David Sniatkiwicz (1): ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds Ken Ma (3): ata: mvebu: move mvebu sata driver to drivers/ata directory ata: ahci_mvebu: add scsi support arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU arch/arm/mach-mvebu/Makefile| 1 - arch/arm/mach-mvebu/sata.c | 54 - configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + drivers/ata/Kconfig | 9 + drivers/ata/Makefile| 1 + drivers/ata/ahci_mvebu.c| 61 + 9 files changed, 75 insertions(+), 55 deletions(-) delete mode 100644 arch/arm/mach-mvebu/sata.c create mode 100644 drivers/ata/ahci_mvebu.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/5] arm64: a37xx: pci: add support for aardvark pcie driver
S_OUT); + /* +* Issue reset to add-in card through the dedicated GPIO. +* Some boards are connecting the card reset pin to common system +* reset wire and others are using separate GPIO port. +* In the last case we have to release a reset of the addon card +* using this GPIO. +* +* FIX-ME: +* The PCIe RESET signal is not supposed to be released along +* with the SOC RESET signal. It should be lowered as early as +* possible before PCIe PHY initialization. Moreover, the PCIe +* clock should be gated as well. +*/ + if (dm_gpio_is_valid(_gpio)) { + dev_dbg(pcie->dev, "Toggle PCIE Reset GPIO ...\n"); + dm_gpio_set_value(_gpio, 0); + mdelay(200); + dm_gpio_set_value(_gpio, 1); + } +#else + dev_dbg(pcie->dev, "PCIE Reset on GPIO support is missing\n"); +#endif /* CONFIG_DM_GPIO */ + + pcie->first_busno = dev->seq; + pcie->dev = pci_get_controller(dev); + + return pcie_advk_setup_hw(pcie); +} + +/** + * pcie_advk_ofdata_to_platdata() - Translate from DT to device state + * + * @dev: A pointer to the device being operated on + * + * Translate relevant data from the device tree pertaining to device @dev into + * state that the driver will later make use of. This state is stored in the + * device's private data structure. + * + * Return: 0 on success, else -EINVAL + */ +static int pcie_advk_ofdata_to_platdata(struct udevice *dev) +{ + struct pcie_advk *pcie = dev_get_priv(dev); + + /* Get the register base address */ + pcie->base = (void *)dev_read_addr_index(dev, 0); + if ((fdt_addr_t)pcie->base == FDT_ADDR_T_NONE) + return -EINVAL; + + return 0; +} + +static const struct dm_pci_ops pcie_advk_ops = { + .read_config= pcie_advk_read_config, + .write_config = pcie_advk_write_config, +}; + +static const struct udevice_id pcie_advk_ids[] = { + { .compatible = "marvell,armada-37xx-pcie" }, + { } +}; + +U_BOOT_DRIVER(pcie_advk) = { + .name = "pcie_advk", + .id = UCLASS_PCI, + .of_match = pcie_advk_ids, + .ops= _advk_ops, + .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, + .probe = pcie_advk_probe, + .priv_auto_alloc_size = sizeof(struct pcie_advk), +}; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/5] arm64: a37xx: defconfigs: enable aardvark pcie driver
From: Wilson DingSigned-off-by: Wilson Ding Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- configs/mvebu_db-88f3720_defconfig | 3 +++ configs/mvebu_espressobin-88f3720_defconfig | 3 +++ 2 files changed, 6 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 1d6233a..ad37efe 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -44,6 +44,9 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_PHY_GIGE=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_PCI_AARDVARK=y CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index bbf39cd..510f057 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -44,6 +44,9 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_PHY_GIGE=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_PCI_AARDVARK=y CONFIG_MVEBU_COMPHY_SUPPORT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_37XX=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 11/13] doc: a37xx: Introduce pinctrl device tree binding
From: Ken MaReviewed-on: http://vgitil04.il.marvell.com:8080/43289 Tested-by: iSoC Platform CI Reviewed-by: Kostya Porotchkin Reviewed-by: Igal Liberman Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- .../pinctrl/marvell,armada-37xx-pinctrl.txt| 186 + 1 file changed, 186 insertions(+) create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-37xx-pinctrl.txt diff --git a/doc/device-tree-bindings/pinctrl/marvell,armada-37xx-pinctrl.txt b/doc/device-tree-bindings/pinctrl/marvell,armada-37xx-pinctrl.txt new file mode 100644 index 000..86ec113 --- /dev/null +++ b/doc/device-tree-bindings/pinctrl/marvell,armada-37xx-pinctrl.txt @@ -0,0 +1,186 @@ +* Marvell Armada 37xx SoC pin and GPIO controller + +Each Armada 37xx SoC comes with two pin and GPIO controllers, one for the +South Bridge and the other for the North Bridge. + +GPIO and pin controller: + + +Main node: + +Refer to pinctrl-bindings.txt in this directory for details of the +common pinctrl bindings used by client devices, including the meaning +of the phrase "pin configuration node". + +Required properties for pinctrl driver: + +- compatible: "marvell,armada3710-sb-pinctrl", "syscon, "simple-mfd" + for the South Bridge + "marvell,armada3710-nb-pinctrl", "syscon, "simple-mfd" + for the North Bridge +- reg: The first set of registers is for pinctrl/GPIO and the second + set is for the interrupt controller +- interrupts: list of interrupts used by the GPIO + +Available groups and functions for the North Bridge: + +group: jtag + - pins 20-24 + - functions jtag, gpio + +group sdio0 + - pins 8-10 + - functions sdio, gpio + +group emmc_nb + - pins 27-35 + - functions emmc, gpio + +group pwm0 + - pin 11 (GPIO1-11) + - functions pwm, gpio + +group pwm1 + - pin 12 + - functions pwm, gpio + +group pwm2 + - pin 13 + - functions pwm, gpio + +group pwm3 + - pin 14 + - functions pwm, gpio + +group pmic1 + - pin 7 + - functions pmic, gpio + +group pmic0 + - pin 6 + - functions pmic, gpio + +group i2c2 + - pins 2-3 + - functions i2c, gpio + +group i2c1 + - pins 0-1 + - functions i2c, gpio + +group spi_cs1 + - pin 17 + - functions spi, gpio + +group spi_cs2 + - pin 18 + - functions spi, gpio + +group spi_cs3 + - pin 19 + - functions spi, gpio + +group onewire + - pin 4 + - functions onewire, gpio + +group uart1 + - pins 25-26 + - functions uart, gpio + +group spi_quad + - pins 15-16 + - functions spi, gpio + +group uart_2 + - pins 9-10 + - functions uart, gpio + +Available groups and functions for the South Bridge: + +group usb32_drvvbus0 + - pin 36 + - functions drvbus, gpio + +group usb2_drvvbus1 + - pin 37 + - functions drvbus, gpio + +group sdio_sb + - pins 60-65 + - functions sdio, gpio + +group rgmii + - pins 42-53 + - functions mii, gpio + +group pcie1 + - pins 39-41 + - functions pcie, gpio + +group smi + - pins 54-55 + - functions smi, gpio + +group ptp + - pins 56-58 + - functions ptp, gpio + +group ptp_clk + - pin 57 + - functions ptp, mii + +group ptp_trig + - pin 58 + - functions ptp, mii + +group mii_col + - pin 59 + - functions mii, mii_err + +GPIO subnode: + +Please refer to gpio.txt in "gpio" directory for details of gpio-ranges property +and the common GPIO bindings used by client devices. + +Required properties for the GPIO driver under the gpio subnode: +- interrupts: List of interrupt specifiers for the controllers interrupt. +- gpio-controller: Marks the device node as a GPIO controller. +- #gpio-cells: Should be 2. The first cell is the GPIO number and the + second cell specifies GPIO flags, as defined in + . Only the GPIO_ACTIVE_HIGH and + GPIO_ACTIVE_LOW flags are supported. +- gpio-ranges: Range of pins managed by the GPIO controller. + +Example: +pinctrl_sb: pinctrl-sb@18800 { + compatible = "marvell,armada3710-sb-pinctrl", + "syscon", "simple-mfd"; + reg = <0x18800 0x100>, <0x18C00 0x20>; + gpiosb: gpiosb { + #gpio-cells = <2>; + gpio-ranges = <_sb 0 0 30>; + gpio-controller; + interrupts = + , + , + , + , + ; + }; + + rgmii_pins: mii-pins { + groups = "rgmii"; + function = "mii"; + }; + + sdio_pins: sdio-pins { + groups = "sdio_sb"; + function = "sdio"; + }; + + pcie_pins: pcie-pins { + groups = "pcie1"; + function = "pcie"; + }; +}; \ No newline at end of file -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/5] arm64: a37xx: dts: enable pcie port
From: Wilson DingThis patch enabled PCIe port on both devel-board and espressobin board. Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Wilson Ding Signed-off-by: Ken Ma --- arch/arm/dts/armada-3720-db.dts | 8 arch/arm/dts/armada-3720-espressobin.dts | 7 +++ arch/arm/dts/armada-37xx.dtsi| 16 3 files changed, 31 insertions(+) diff --git a/arch/arm/dts/armada-3720-db.dts b/arch/arm/dts/armada-3720-db.dts index 52fc134..770c08a 100644 --- a/arch/arm/dts/armada-3720-db.dts +++ b/arch/arm/dts/armada-3720-db.dts @@ -154,3 +154,11 @@ { status = "okay"; }; + +/* CON17 */ + { + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + reset-gpio = < 3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; diff --git a/arch/arm/dts/armada-3720-espressobin.dts b/arch/arm/dts/armada-3720-espressobin.dts index 4e70d88..7bfccb0 100644 --- a/arch/arm/dts/armada-3720-espressobin.dts +++ b/arch/arm/dts/armada-3720-espressobin.dts @@ -141,3 +141,10 @@ { status = "okay"; }; + + { + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + reset-gpio = < 3 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 9fc87c9..5400742 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -294,5 +294,21 @@ max-lanes = <2>; }; }; + + pcie0: pcie@d007 { + compatible = "marvell,armada-37xx-pcie"; + reg = <0 0xd007 0 0x2>; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + num-lanes = <1>; + status = "disabled"; + + bus-range = <0 0xff>; + ranges = <0x8200 0 0xe800 +0 0xe800 0 0x100 /* Port 0 MEM */ +0x8100 0 0xe900 +0 0xe900 0 0x1>; /* Port 0 IO*/ + }; }; }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 12/13] Revert "arm64: a37xx: dts: Add pin control nodes to DT"
From: Ken MaThe commit "arm64: mvebu: Add pinctrl nodes for Armada 3700" has added new pinctrl nodes. This reverts commit f7cab0f95b05ec6a66fe4796b9ad44406d0cc864. Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-37xx.dtsi | 14 -- 1 file changed, 14 deletions(-) diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 301f9ee..9fc87c9 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -286,20 +286,6 @@ status = "disabled"; }; - pinctl0: pinctl@13830 { /* north bridge */ - compatible = "marvell,armada-3700-pinctl"; - bank-name = "armada-3700-nb"; - reg = <0x13830 0x4>; - pin-count = <36>; - }; - - pinctl1: pinctl@18830 { /* south bridge */ - compatible = "marvell,armada-3700-pinctl"; - bank-name = "armada-3700-sb"; - reg = <0x18830 0x4>; - pin-count = <30>; - }; - comphy: comphy@18300 { compatible = "marvell,mvebu-comphy", "marvell,comphy-armada-3700"; reg = <0x18300 0x28>, -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/5] arm64: a37xx: populate pcie memory region
From: Wilson DingThis patch added a new region of 32MiB AT 0xe800. to Armada37x0's memory map. This region is supposed to be mapped in MMU in order to enable the access to the PCI I/O or MEM resources. Signed-off-by: Wilson Ding Reviewed-on: http://vgitil04.il.marvell.com:8080/38724 Tested-by: iSoC Platform CI Reviewed-by: Victor Gu Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese --- arch/arm/mach-mvebu/armada3700/cpu.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-mvebu/armada3700/cpu.c index 6499eec..cfe4469 100644 --- a/arch/arm/mach-mvebu/armada3700/cpu.c +++ b/arch/arm/mach-mvebu/armada3700/cpu.c @@ -46,6 +46,14 @@ static struct mm_region mvebu_mem_map[] = { PTE_BLOCK_NON_SHARE }, { + /* PCI regions */ + .phys = 0xe800UL, + .virt = 0xe800UL, + .size = 0x0200UL, /* 32MiB master PCI space */ + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE + }, + { /* List terminator */ 0, } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 07/13] arm64: a37xx: pinctrl: Fix the pin 23 on south bridge
From: Ken MaPin 23 on South bridge does not belong to the rgmii group. It belongs to a separate group which can have 3 functions. Due to this the fix also have to update the way the functions are managed. Until now each groups used NB_FUNCS(which was 2) functions. For the mpp23, 3 functions are available but it is the only group which needs it, so on the loop involving NB_FUNCS an extra test was added to handle only the functions added. The bug was visible when the gpio regulator used the gpio 23, the whole rgmii group was setup to gpio which broke the Ethernet support on the Armada 3720 DB board. Thanks to this patch, the UHS SD cards (which need the vqmmc) _and_ the Ethernet work again. Reviewed-on: http://vgitil04.il.marvell.com:8080/43284 Reviewed-by: Hua Jing Tested-by: iSoC Platform CI Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index d058fba..d32467b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; #define IRQ_STATUS 0x10 #define IRQ_WKUP 0x18 -#define NB_FUNCS 2 +#define NB_FUNCS 3 #define GPIO_PER_REG 32 /** @@ -128,6 +128,16 @@ struct armada_37xx_pinctrl { .funcs = {_func1, "gpio"} \ } +#define PIN_GRP_GPIO_3(_name, _start, _nr, _mask, _v1, _v2, _v3, _f1, _f2) \ + { \ + .name = _name, \ + .start_pin = _start,\ + .npins = _nr, \ + .reg_mask = _mask, \ + .val = {_v1, _v2, _v3}, \ + .funcs = {_f1, _f2, "gpio"} \ + } + #define PIN_GRP_EXTRA(_name, _start, _nr, _mask, _v1, _v2, _start2, _nr2, \ _f1, _f2) \ { \ @@ -178,7 +188,8 @@ static struct armada_37xx_pin_group armada_37xx_sb_groups[] = { PIN_GRP_GPIO("ptp", 20, 3, BIT(5), "ptp"), PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"), PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"), - PIN_GRP("mii_col", 23, 1, BIT(8), "mii", "mii_err"), + PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14), + "mii", "mii_err"), }; const struct armada_37xx_pin_data armada_37xx_pin_nb = { @@ -210,7 +221,7 @@ static int armada_37xx_get_func_reg(struct armada_37xx_pin_group *grp, { int f; - for (f = 0; f < NB_FUNCS; f++) + for (f = 0; (f < NB_FUNCS) && grp->funcs[f]; f++) if (!strcmp(grp->funcs[f], func)) return f; @@ -352,7 +363,7 @@ static int armada_37xx_fill_group(struct armada_37xx_pinctrl *info) for (j = 0; j < grp->extra_npins; j++) grp->pins[i+j] = grp->extra_pin + j; - for (f = 0; f < NB_FUNCS; f++) { + for (f = 0; (f < NB_FUNCS) && grp->funcs[f]; f++) { int ret; /* check for unique functions and count groups */ ret = armada_37xx_add_function(info->funcs, , @@ -404,7 +415,7 @@ static int armada_37xx_fill_func(struct armada_37xx_pinctrl *info) struct armada_37xx_pin_group *gp = >groups[g]; int f; - for (f = 0; f < NB_FUNCS; f++) { + for (f = 0; (f < NB_FUNCS) && gp->funcs[f]; f++) { if (strcmp(gp->funcs[f], name) == 0) { *groups = gp->name; groups++; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 5/5] arm64: a37xx: defconfigs: enable PCI_CMD and E1000 driver
From: Ken MaCc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- configs/mvebu_db-88f3720_defconfig | 2 ++ configs/mvebu_espressobin-88f3720_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index ad37efe..980c0df 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -17,6 +17,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_PCI=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -44,6 +45,7 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_PHY_GIGE=y +CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 510f057..aedb83a 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -17,6 +17,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_PCI=y CONFIG_CMD_SF=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -44,6 +45,7 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_PHY_GIGE=y +CONFIG_E1000=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_PCI_AARDVARK=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/5] *** SUBJECT HERE ***
From: Ken MaThe below patches introduce aardvark pcie driver and enable pcie for Armada 37xx. Ken Ma (1): arm64: a37xx: defconfigs: enable PCI_CMD and E1000 driver Wilson Ding (4): arm64: a37xx: populate pcie memory region arm64: a37xx: pci: add support for aardvark pcie driver arm64: a37xx: defconfigs: enable aardvark pcie driver arm64: a37xx: dts: enable pcie port arch/arm/dts/armada-3720-db.dts | 8 + arch/arm/dts/armada-3720-espressobin.dts| 7 + arch/arm/dts/armada-37xx.dtsi | 16 + arch/arm/mach-mvebu/armada3700/cpu.c| 8 + configs/mvebu_db-88f3720_defconfig | 5 + configs/mvebu_espressobin-88f3720_defconfig | 5 + drivers/pci/Kconfig | 10 + drivers/pci/Makefile| 1 + drivers/pci/pci-aardvark.c | 690 9 files changed, 750 insertions(+) create mode 100644 drivers/pci/pci-aardvark.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 09/13] arm64: a37xx: pinctrl: Correct mpp definitions
From: Ken MaThis patch corrects below mpp definitions: - The sdio_sb group is composed of 6 pins and not 5; - The rgmii group contains pins mpp2[17:6] and not mpp2[19:6]; - Pin of group "pmic0" is mpp1[6] but not mpp1[16]; - Pin of group "pmic1" is mpp1[7] but not mpp1[17]; - A new group "smi" is added in A0 with 2 pins - mpp2[19:18], its bitmask is bit4; - Group "pcie1" has 3 pins in A0 - mpp2[5:3], its bit mask is bit5 | bit9 | bit10 but not bit4; - Group "ptp" has 3 pins in A0 as Z1, but its bitmask is changed to bit11 | bit12 | bit13. Reviewed-on: http://vgitil04.il.marvell.com:8080/43288 Tested-by: iSoC Platform CI Reviewed-by: Hua Jing Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index b442ded..010eb20 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -159,8 +159,8 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { PIN_GRP_GPIO("pwm1", 12, 1, BIT(4), "pwm"), PIN_GRP_GPIO("pwm2", 13, 1, BIT(5), "pwm"), PIN_GRP_GPIO("pwm3", 14, 1, BIT(6), "pwm"), - PIN_GRP_GPIO("pmic1", 17, 1, BIT(7), "pmic"), - PIN_GRP_GPIO("pmic0", 16, 1, BIT(8), "pmic"), + PIN_GRP_GPIO("pmic1", 7, 1, BIT(7), "pmic"), + PIN_GRP_GPIO("pmic0", 6, 1, BIT(8), "pmic"), PIN_GRP_GPIO("i2c2", 2, 2, BIT(9), "i2c"), PIN_GRP_GPIO("i2c1", 0, 2, BIT(10), "i2c"), PIN_GRP_GPIO("spi_cs1", 17, 1, BIT(12), "spi"), @@ -182,10 +182,11 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { static struct armada_37xx_pin_group armada_37xx_sb_groups[] = { PIN_GRP_GPIO("usb32_drvvbus0", 0, 1, BIT(0), "drvbus"), PIN_GRP_GPIO("usb2_drvvbus1", 1, 1, BIT(1), "drvbus"), - PIN_GRP_GPIO("sdio_sb", 24, 5, BIT(2), "sdio"), - PIN_GRP_EXTRA("rgmii", 6, 14, BIT(3), 0, BIT(3), 23, 1, "mii", "gpio"), - PIN_GRP_GPIO("pcie1", 3, 2, BIT(4), "pcie"), - PIN_GRP_GPIO("ptp", 20, 3, BIT(5), "ptp"), + PIN_GRP_GPIO("sdio_sb", 24, 6, BIT(2), "sdio"), + PIN_GRP_GPIO("rgmii", 6, 12, BIT(3), "mii"), + PIN_GRP_GPIO("smi", 18, 2, BIT(4), "smi"), + PIN_GRP_GPIO("pcie1", 3, 3, BIT(5) | BIT(9) | BIT(10), "pcie"), + PIN_GRP_GPIO("ptp", 20, 3, BIT(11) | BIT(12) | BIT(13), "ptp"), PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"), PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"), PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14), -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 08/13] arm64: a37xx: pinctrl: Fix gpio pin offset in register
From: Ken MaFor armada_37xx_update_reg(), the parameter offset should be pointer so that it can be updated, otherwise offset will keep old value, and then when offset is larger than or equal to 32 the mask calculated by "BIT(offset)" will be 0 in gpio chip hook functions, it's an error, this patch set offset parameter of armada_37xx_update_reg() as pointer. Reviewed-on: http://vgitil04.il.marvell.com:8080/43287 Reviewed-by: Hua Jing Tested-by: iSoC Platform CI Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index d32467b..b442ded 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -207,11 +207,11 @@ const struct armada_37xx_pin_data armada_37xx_pin_sb = { }; static inline void armada_37xx_update_reg(unsigned int *reg, - unsigned int offset) + unsigned int *offset) { /* We never have more than 2 registers */ - if (offset >= GPIO_PER_REG) { - offset -= GPIO_PER_REG; + if (*offset >= GPIO_PER_REG) { + *offset -= GPIO_PER_REG; *reg += sizeof(u32); } } @@ -432,7 +432,7 @@ static int armada_37xx_gpio_get(struct udevice *dev, unsigned int offset) unsigned int reg = INPUT_VAL; unsigned int val, mask; - armada_37xx_update_reg(, offset); + armada_37xx_update_reg(, ); mask = BIT(offset); val = readl(info->base + reg); @@ -447,7 +447,7 @@ static int armada_37xx_gpio_set(struct udevice *dev, unsigned int offset, unsigned int reg = OUTPUT_VAL; unsigned int mask, val; - armada_37xx_update_reg(, offset); + armada_37xx_update_reg(, ); mask = BIT(offset); val = value ? mask : 0; @@ -463,7 +463,7 @@ static int armada_37xx_gpio_get_direction(struct udevice *dev, unsigned int reg = OUTPUT_EN; unsigned int val, mask; - armada_37xx_update_reg(, offset); + armada_37xx_update_reg(, ); mask = BIT(offset); val = readl(info->base + reg); @@ -480,7 +480,7 @@ static int armada_37xx_gpio_direction_input(struct udevice *dev, unsigned int reg = OUTPUT_EN; unsigned int mask; - armada_37xx_update_reg(, offset); + armada_37xx_update_reg(, ); mask = BIT(offset); clrbits_le32(info->base + reg, mask); @@ -495,7 +495,7 @@ static int armada_37xx_gpio_direction_output(struct udevice *dev, unsigned int reg = OUTPUT_EN; unsigned int mask; - armada_37xx_update_reg(, offset); + armada_37xx_update_reg(, ); mask = BIT(offset); setbits_le32(info->base + reg, mask); -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 02/13] arm64: a37xx: defconfig: Enable PINCTRL and GPIO support for ESPRESSOBin board
From: Ken MaThis patch enable the PINCTRL and GPIO support, including the GPIO command on the Armada 3720 espressobin board. Reviewed-on: http://vgitil04.il.marvell.com:8080/40746 Tested-by: iSoC Platform CI Reviewed-by: Wilson Ding Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- configs/mvebu_espressobin-88f3720_defconfig | 4 1 file changed, 4 insertions(+) diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index 314d405..bbf39cd 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -14,6 +14,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_ARCH_EARLY_INIT_R=y CONFIG_BOARD_EARLY_INIT_F=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_SF=y @@ -29,6 +30,7 @@ CONFIG_MAC_PARTITION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SCSI_AHCI=y CONFIG_BLOCK_CACHE=y +CONFIG_DM_GPIO=y CONFIG_DM_I2C=y CONFIG_MISC=y CONFIG_DM_MMC=y @@ -43,6 +45,8 @@ CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_PHY_GIGE=y CONFIG_MVEBU_COMPHY_SUPPORT=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_ARMADA_37XX=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DEBUG_MVEBU_A3700_UART=y CONFIG_DEBUG_UART_BASE=0xd0012000 -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 05/13] arm64: a37xx: pinctrl: Fix number of pin in south bridge
From: Ken MaOn the south bridge we have pin from 0 to 29, so it gives 30 pins (and not 29). Reviewed-on: http://vgitil04.il.marvell.com:8080/43285 Tested-by: iSoC Platform CI Reviewed-by: Hua Jing Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 2bf853e..d058fba 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -189,7 +189,7 @@ const struct armada_37xx_pin_data armada_37xx_pin_nb = { }; const struct armada_37xx_pin_data armada_37xx_pin_sb = { - .nr_pins = 29, + .nr_pins = 30, .name = "GPIO2", .groups = armada_37xx_sb_groups, .ngroups = ARRAY_SIZE(armada_37xx_sb_groups), -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 13/13] arm64: a37xx: remove old pinctrl implementation
From: Ken MaSince the new pinctrl/gpio driver is used, so this patch removes the old board specific pin control settings. Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- board/Marvell/mvebu_armada-37xx/board.c | 23 --- 1 file changed, 23 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index ac3e3a3..e205396 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -50,29 +50,6 @@ DECLARE_GLOBAL_DATA_PTR; int board_early_init_f(void) { - const void *blob = gd->fdt_blob; - const char *bank_name; - const char *compat = "marvell,armada-3700-pinctl"; - int off, len; - void __iomem *addr; - - /* FIXME -* Temporary WA for setting correct pin control values -* until the real pin control driver is awailable. -*/ - off = fdt_node_offset_by_compatible(blob, -1, compat); - while (off != -FDT_ERR_NOTFOUND) { - bank_name = fdt_getprop(blob, off, "bank-name", ); - addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent( - blob, off, "reg", 0, NULL, true); - if (!strncmp(bank_name, "armada-3700-nb", len)) - writel(PINCTRL_NB_REG_VALUE, addr); - else if (!strncmp(bank_name, "armada-3700-sb", len)) - writel(PINCTRL_SB_REG_VALUE, addr); - - off = fdt_node_offset_by_compatible(blob, off, compat); - } - return 0; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 10/13] arm64: a37xx: dts: Correct mpp definitions
From: Ken MaThis patch corrects below mpp definitions for armada 3720 DB board and ESPRESSOBin board: - "smi" pins group is added and "smi" function is set for eth0; - Now pcie pins are used as gpio to implement PCIe function in hardware, so "pcie" group function is changed to "gpio". Reviewed-on: http://vgitil04.il.marvell.com:8080/43287 Reviewed-by: Hua Jing Tested-by: iSoC Platform CI Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-37xx.dtsi| 7 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/dts/armada-3720-db.dts b/arch/arm/dts/armada-3720-db.dts index 88baf33..52fc134 100644 --- a/arch/arm/dts/armada-3720-db.dts +++ b/arch/arm/dts/armada-3720-db.dts @@ -82,7 +82,7 @@ { pinctrl-names = "default"; - pinctrl-0 = <_pins>; + pinctrl-0 = <_pins>, <_pins>; status = "okay"; phy-mode = "rgmii"; }; diff --git a/arch/arm/dts/armada-3720-espressobin.dts b/arch/arm/dts/armada-3720-espressobin.dts index 5d8d27e..4e70d88 100644 --- a/arch/arm/dts/armada-3720-espressobin.dts +++ b/arch/arm/dts/armada-3720-espressobin.dts @@ -90,7 +90,7 @@ { status = "okay"; pinctrl-names = "default"; - pinctrl-0 = <_pins>; + pinctrl-0 = <_pins>, <_pins>; phy-mode = "rgmii"; phy_addr = <0x1>; fixed-link { diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index d139a61..301f9ee 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -183,6 +183,11 @@ function = "mii"; }; + smi_pins: smi-pins { + groups = "smi"; + function = "smi"; + }; + sdio_pins: sdio-pins { groups = "sdio_sb"; function = "sdio"; @@ -190,7 +195,7 @@ pcie_pins: pcie-pins { groups = "pcie1"; - function = "pcie"; + function = "gpio"; }; }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 06/13] arm64: a37xx: dts: Fix the number of GPIO on south bridge
From: Ken MaThe number of pins in South Bridge is 30 and not 29. There is a fix for the driver for the pinctrl, but a fix is also need at device tree level for the GPIO. Reviewed-on: http://vgitil04.il.marvell.com:8080/43286 Reviewed-by: Hua Jing Tested-by: iSoC Platform CI Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-37xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index fab95bb..d139a61 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -168,7 +168,7 @@ reg = <0x18800 0x100>, <0x18C00 0x20>; gpiosb: gpiosb { #gpio-cells = <2>; - gpio-ranges = <_sb 0 0 29>; + gpio-ranges = <_sb 0 0 30>; gpio-controller; interrupts = , -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 03/13] arm64: a37xx: dts: Add pinctrl configuration for ESPRESSOBin board
From: Ken MaReviewed-on: http://vgitil04.il.marvell.com:8080/40913 Reviewed-by: Wilson Ding Tested-by: Wilson Ding Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-3720-espressobin.dts | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/dts/armada-3720-espressobin.dts b/arch/arm/dts/armada-3720-espressobin.dts index aa6587a..5d8d27e 100644 --- a/arch/arm/dts/armada-3720-espressobin.dts +++ b/arch/arm/dts/armada-3720-espressobin.dts @@ -89,6 +89,8 @@ { status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; phy-mode = "rgmii"; phy_addr = <0x1>; fixed-link { @@ -98,6 +100,8 @@ }; { + pinctrl-names = "default"; + pinctrl-0 = <_pins>; status = "okay"; }; @@ -108,6 +112,8 @@ { status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_quad_pins>; spi-flash@0 { #address-cells = <1>; @@ -121,6 +127,8 @@ /* Exported on the micro USB connector CON32 through an FTDI */ { + pinctrl-names = "default"; + pinctrl-0 = <_pins>; status = "okay"; }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 04/13] arm64: a37xx: dts: Add additional pinctrl definition
From: Ken MaAdd mmc pins, pcie pins and sdio pins definition and do these pins' configuration for DB board and espressobin board; Add uart2 pins configuration for DB board. Reviewed-on: http://vgitil04.il.marvell.com:8080/40914 Reviewed-by: Wilson Ding Tested-by: Wilson Ding Cc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-3720-db.dts | 4 arch/arm/dts/armada-37xx.dtsi | 14 ++ 2 files changed, 18 insertions(+) diff --git a/arch/arm/dts/armada-3720-db.dts b/arch/arm/dts/armada-3720-db.dts index 5f06252..88baf33 100644 --- a/arch/arm/dts/armada-3720-db.dts +++ b/arch/arm/dts/armada-3720-db.dts @@ -100,6 +100,8 @@ { bus-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; status = "okay"; }; @@ -109,6 +111,8 @@ mmc-ddr-1_8v; mmc-hs400-1_8v; marvell,pad-type = "fixed-1-8v"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; status = "okay"; #address-cells = <1>; diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 75a22de..fab95bb 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -155,6 +155,11 @@ groups = "uart2"; function = "uart"; }; + + mmc_pins: mmc-pins { + groups = "emmc_nb"; + function = "emmc"; + }; }; pinctrl_sb: pinctrl-sb@18800 { @@ -178,6 +183,15 @@ function = "mii"; }; + sdio_pins: sdio-pins { + groups = "sdio_sb"; + function = "sdio"; + }; + + pcie_pins: pcie-pins { + groups = "pcie1"; + function = "pcie"; + }; }; usb3: usb@58000 { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 01/13] arm64: a37xx: dts: add gpio head file including
From: Ken MaCc: Simon Glass Cc: Stefan Roese Signed-off-by: Ken Ma --- arch/arm/dts/armada-37xx.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 6902342..75a22de 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -46,6 +46,7 @@ #include #include +#include / { model = "Marvell Armada 37xx SoC"; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 00/13] *** SUBJECT HERE ***
From: Ken MaThe below patches fix new pinctrl driver issues and remove old obsolete pinctrl implementation for Armada 37xx. Ken Ma (13): arm64: a37xx: dts: add gpio head file including arm64: a37xx: defconfig: Enable PINCTRL and GPIO support for ESPRESSOBin board arm64: a37xx: dts: Add pinctrl configuration for ESPRESSOBin board arm64: a37xx: dts: Add additional pinctrl definition arm64: a37xx: pinctrl: Fix number of pin in south bridge arm64: a37xx: dts: Fix the number of GPIO on south bridge arm64: a37xx: pinctrl: Fix the pin 23 on south bridge arm64: a37xx: pinctrl: Fix gpio pin offset in register arm64: a37xx: pinctrl: Correct mpp definitions arm64: a37xx: dts: Correct mpp definitions doc: a37xx: Introduce pinctrl device tree binding Revert "arm64: a37xx: dts: Add pin control nodes to DT" arm64: a37xx: remove old pinctrl implementation arch/arm/dts/armada-3720-db.dts| 6 +- arch/arm/dts/armada-3720-espressobin.dts | 8 + arch/arm/dts/armada-37xx.dtsi | 36 ++-- board/Marvell/mvebu_armada-37xx/board.c| 23 --- configs/mvebu_espressobin-88f3720_defconfig| 4 + .../pinctrl/marvell,armada-37xx-pinctrl.txt| 186 + drivers/pinctrl/mvebu/pinctrl-armada-37xx.c| 52 +++--- 7 files changed, 256 insertions(+), 59 deletions(-) create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-37xx-pinctrl.txt -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] pinctrl: a3700: Fix uart2 group selection register mask
From: Ken MaIf north bridge selection register bit1 is clear, pins [10:8] are for SDIO0 Resetn, Wakeup, and PDN while if bit1 is set, pins [10:8]are for GPIO; when bit1 is clear, pin 9 and pin 10 can be used for uart2 RTSn and CTSn, so bit1 should be added to uart2 group and it must be set for both "gpio" and "uart" functions of uart2 group. Signed-off-by: Ken Ma Cc: Stefan Roese Cc: Kostya Porotchkin Cc: Gregory CLEMENT Cc: Nadav Haklai Cc: Wilson Ding --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 3bb4c43..2ac66ec 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -159,8 +159,9 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { PIN_GRP_GPIO("onewire", 4, 1, BIT(16), "onewire"), PIN_GRP_GPIO("uart1", 25, 2, BIT(17), "uart"), PIN_GRP_GPIO("spi_quad", 15, 2, BIT(18), "spi"), - PIN_GRP_EXTRA("uart2", 9, 2, BIT(13) | BIT(14) | BIT(19), - BIT(13) | BIT(14), BIT(19), 18, 2, "gpio", "uart"), + PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19), + BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19), + 18, 2, "gpio", "uart"), PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"), PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"), PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"), -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] pinctrl: a3700: Fix the issue that gpio controller is registered with wrong node id
From: Ken MaIn armada_37xx_gpiochip_register, the return value of fdtdec_get_bool should be true when gpio-controller is found; current codes makes a wrong inverse return value judgement, this patch fixes it. Signed-off-by: Ken Ma Cc: Stefan Roese Cc: Kostya Porotchkin Cc: Gregory CLEMENT Cc: Nadav Haklai Cc: Wilson Ding --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 2ac66ec..27165b0 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -539,7 +539,7 @@ static int armada_37xx_gpiochip_register(struct udevice *parent, } fdt_for_each_subnode(subnode, blob, node) { - if (!fdtdec_get_bool(blob, subnode, "gpio-controller")) { + if (fdtdec_get_bool(blob, subnode, "gpio-controller")) { ret = 0; break; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] *** SUBJECT HERE ***
From: Ken Ma*** BLURB HERE *** Fix 2 armada-37xx pinctrl issues. Ken Ma (2): pinctrl: a3700: Fix uart2 group selection register mask pinctrl: a3700: Fix the issue that gpio controller is registered with wrong node id drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] pinctrl: a3700: Fix the issue that gpio controller is registered with wrong node id
From: Ken MaIn armada_37xx_gpiochip_register, the return value of fdtdec_get_bool should be true when gpio-controller is found; current codes makes a wrong inverse return value judgement, this patch fixes it. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Cc: Kostya Porotchkin --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 2ac66ec..27165b0 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -539,7 +539,7 @@ static int armada_37xx_gpiochip_register(struct udevice *parent, } fdt_for_each_subnode(subnode, blob, node) { - if (!fdtdec_get_bool(blob, subnode, "gpio-controller")) { + if (fdtdec_get_bool(blob, subnode, "gpio-controller")) { ret = 0; break; } -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] pinctrl: a3700: Fix uart2 group selection register mask
From: Ken MaIf north bridge selection register bit1 is clear, pins [10:8] are for SDIO0 Resetn, Wakeup, and PDN while if bit1 is set, pins [10:8]are for GPIO; when bit1 is clear, pin 9 and pin 10 can be used for uart2 RTSn and CTSn, so bit1 should be added to uart2 group and it must be set for both "gpio" and "uart" functions of uart2 group. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Cc: Kostya Porotchkin --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 3bb4c43..2ac66ec 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -159,8 +159,9 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { PIN_GRP_GPIO("onewire", 4, 1, BIT(16), "onewire"), PIN_GRP_GPIO("uart1", 25, 2, BIT(17), "uart"), PIN_GRP_GPIO("spi_quad", 15, 2, BIT(18), "spi"), - PIN_GRP_EXTRA("uart2", 9, 2, BIT(13) | BIT(14) | BIT(19), - BIT(13) | BIT(14), BIT(19), 18, 2, "gpio", "uart"), + PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19), + BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19), + 18, 2, "gpio", "uart"), PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"), PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"), PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"), -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/2] *** SUBJECT HERE ***
From: Ken Ma*** BLURB HERE *** Fix 2 armada37x0 pinctrl issues. Ken Ma (2): pinctrl: a3700: Fix uart2 group selection register mask pinctrl: a3700: Fix the issue that gpio controller is registered with wrong node id drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 6/7] scsi: a3700: enable mvebu scsi driver
From: Ken Ma- Enable SCSI support in Armada-3700 DB default configuration. Reviewed-on: http://vgitil04.il.marvell.com:8080/35302 Reviewed-by: Omri Itach Tested-by: iSoC Platform CI Reviewed-by: Kostya Porotchkin Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek --- configs/mvebu_db-88f3720_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index 80f2599..53b3c38 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -33,6 +33,8 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_MAC_PARTITION=y CONFIG_ISO_PARTITION=y CONFIG_EFI_PARTITION=y +CONFIG_DM_SCSI=y +CONFIG_MVEBU_SCSI=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 5/7] scsi: mvebu: add scsi driver
From: Ken Ma- Add mvebu scsi driver which is based on scsi uclass so that scsi command can work when driver model is enabled for scsi; - Mvebu scsi is serial attached scsi and act as an add-on host bus adapter. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35301 Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin Tested-by: iSoC Platform CI --- drivers/block/Kconfig | 10 ++ drivers/block/Makefile | 1 + drivers/block/mvebu_scsi.c | 31 +++ 3 files changed, 42 insertions(+) create mode 100644 drivers/block/mvebu_scsi.c diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 88e66e2..bb27a7f 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -28,6 +28,16 @@ config DM_SCSI (IDs/LUNs) a block device is created with RAW read/write and filesystem support. +config MVEBU_SCSI + bool "Marvell MVEBU SCSI driver" + depends on DM_SCSI + default n + help + Say yes here to support Marvell MVEBU SCSI. + Marvell MVEBU SCSI supports serial attached SCSI(SAS), + which offers backward compatibility with SATA, versions 2 and later. + It allows for SATA drives to be connected to SAS backplanes. + config BLOCK_CACHE bool "Use block device cache" default n diff --git a/drivers/block/Makefile b/drivers/block/Makefile index a72feec..88fe17d 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -29,5 +29,6 @@ obj-$(CONFIG_SATA_SIL) += sata_sil.o obj-$(CONFIG_IDE_SIL680) += sil680.o obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o sata_sandbox.o obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o +obj-$(CONFIG_MVEBU_SCSI) += mvebu_scsi.o obj-$(CONFIG_SYSTEMACE) += systemace.o obj-$(CONFIG_BLOCK_CACHE) += blkcache.o diff --git a/drivers/block/mvebu_scsi.c b/drivers/block/mvebu_scsi.c new file mode 100644 index 000..0151edcb --- /dev/null +++ b/drivers/block/mvebu_scsi.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016 Marvell International Ltd. + * + * SPDX-License-Identifier:GPL-2.0 + * https://spdx.org/licenses + */ + +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static int mvebu_scsi_probe(struct udevice *bus) +{ + /* Do nothing */ + return 0; +} + +static const struct udevice_id mvebu_scsi_ids[] = { + { .compatible = "marvell,mvebu-scsi" }, + { } +}; + +U_BOOT_DRIVER(scsi_mvebu_drv) = { + .name = "scsi_mvebu", + .id = UCLASS_SCSI, + .of_match = mvebu_scsi_ids, + .probe = mvebu_scsi_probe, +}; + -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/7] scsi: add children devices binding
From: Ken Ma- When scsi controller acts as a bus, we need to bind its children scsi devices(scsi hdd, cd, dvd, scanner) to their drivers as spi controller binds spi flashes, so scsi-uclass's post bind function calls dm_scan_fdt_dev() to bind scsi subnode devices; - When scsi controller is a Serial Attached SCSI, it can also work as a pure controller as an on-board component on the motherboard, it may has no subnodes in fdt, then dm_scan_fdt_dev() does nothing and has no effect. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35425 Tested-by: iSoC Platform CI Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin --- drivers/block/scsi-uclass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/block/scsi-uclass.c b/drivers/block/scsi-uclass.c index 3bf026b..86eddfc 100644 --- a/drivers/block/scsi-uclass.c +++ b/drivers/block/scsi-uclass.c @@ -45,6 +45,9 @@ static int scsi_post_bind(struct udevice *dev) { /* Get uclass plat data from fdt */ scsi_ofdata_to_uclass_platdata(dev); + + /* bind subnode devices */ + return dm_scan_fdt_dev(dev); } UCLASS_DRIVER(scsi) = { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 7/7] scsi: dts: a3700: add scsi node
From: Ken Ma- Add scsi node which acts as a bus for scsi devices, armada3700 has only 1 scsi interface, so max-id is 1, and the logic unit number is also 1 for armada3700; - Since a3700's scsi is sas(serial attached scsi) which is compatible for sata and sata hard disk is a sas device, so move sata node to be under scsi node. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35303 Tested-by: iSoC Platform CI Reviewed-by: Kostya Porotchkin Reviewed-by: Omri Itach --- arch/arm/dts/armada-3720-db.dts | 4 arch/arm/dts/armada-37xx.dtsi | 16 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/armada-3720-db.dts b/arch/arm/dts/armada-3720-db.dts index 85761af..9fc60f6 100644 --- a/arch/arm/dts/armada-3720-db.dts +++ b/arch/arm/dts/armada-3720-db.dts @@ -89,6 +89,10 @@ status = "okay"; }; + { + status = "okay"; +}; + /* CON3 */ { status = "okay"; diff --git a/arch/arm/dts/armada-37xx.dtsi b/arch/arm/dts/armada-37xx.dtsi index 062f2a6..de5d3a1 100644 --- a/arch/arm/dts/armada-37xx.dtsi +++ b/arch/arm/dts/armada-37xx.dtsi @@ -149,11 +149,19 @@ status = "disabled"; }; - sata: sata@e { - compatible = "marvell,armada-3700-ahci"; - reg = <0xe 0x2000>; - interrupts = ; + scsi: scsi { + compatible = "marvell,mvebu-scsi"; + #address-cells = <1>; + #size-cells = <1>; + max-id = <1>; + max-lun = <1>; status = "disabled"; + sata: sata@e { + compatible = "marvell,armada-3700-ahci"; + reg = <0xe 0x2000>; + interrupts = ; + status = "disabled"; + }; }; gic: interrupt-controller@1d0 { -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/7] scsi: dt-bindings: add scsi device tree bindings
From: Ken Ma- Add generic scsi device tree bindings doc, the doc includes: - Brief introduction for scsi; - Scsi's properties' introduction; - Add marvell mvebu scsi binding doc with the example of armada3700 SCSI controller. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35427 Tested-by: iSoC Platform CI Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin --- .../scsi/marvell,mvebu-scsi.txt| 29 ++ doc/device-tree-bindings/scsi/scsi-bus.txt | 22 2 files changed, 51 insertions(+) create mode 100644 doc/device-tree-bindings/scsi/marvell,mvebu-scsi.txt create mode 100644 doc/device-tree-bindings/scsi/scsi-bus.txt diff --git a/doc/device-tree-bindings/scsi/marvell,mvebu-scsi.txt b/doc/device-tree-bindings/scsi/marvell,mvebu-scsi.txt new file mode 100644 index 000..b3d06af --- /dev/null +++ b/doc/device-tree-bindings/scsi/marvell,mvebu-scsi.txt @@ -0,0 +1,29 @@ +Binding for marvell mvebu SCSI controller + +Required properties: +- #address-cells - the number of cells used to represent physical base addresses +- #size-cells - the number of cells used to represent the size of an address +- compatible - the name of mvebu SCSI bus controller, supported value "marvell,mvebu-scsi", +covers the following Marvell SoC families: armada3700, armada70x0 and armada80x0 + +Optional property: +- max-id - maximum number of scsi target ids, the default value is CONFIG_SYS_SCSI_MAX_SCSI_ID +- max-lun - maximum number of scsi logical units, the default value is CONFIG_SYS_SCSI_MAX_LUN + +Example for armada3700 SCSI controller which is SAS and acts as an add-on host bus adapter without the +base register: +- Armada3700 has only 1 SATA interface, so the property "max-id" is 1; +- Armada3700 max logical units number is 1, so the property "max-lun" is 1. + + scsi: scsi { + compatible = "marvell,mvebu-scsi"; + #address-cells = <1>; + #size-cells = <1>; + max-id = <1>; + max-lun = <1>; + sata: sata@e { + compatible = "marvell,armada-3700-ahci"; + reg = <0xe 0x2000>; + interrupts = ; + }; + }; diff --git a/doc/device-tree-bindings/scsi/scsi-bus.txt b/doc/device-tree-bindings/scsi/scsi-bus.txt new file mode 100644 index 000..01aee06 --- /dev/null +++ b/doc/device-tree-bindings/scsi/scsi-bus.txt @@ -0,0 +1,22 @@ +SCSI (Small Computer System Interface) busses + +SCSI busses can be described with a node for the SCSI controller device +and a set of child nodes for each SCSI devices on the bus. An SCSI controller +node can also be a Serial Attached SCSI (SAS) controller, which can act as an +add-on host bus adapter or work as a pure controller as an on-board component +on the motherboard, to offer compatibility with SATA devices. + +The SCSI controller node requires the following properties: +- #address-cells - the number of cells used to represent physical base addresses +- #size-cells - the number of cells used to represent the size of an address +- compatible - the name of SCSI bus controller following generic names recommended practice + +No other properties are required in the SCSI bus node. It is assumed +that a driver for an SCSI bus device will understand that it is an SCSI bus. + +Optional property: +- base- scsi register base address +- max-id - maximum number of scsi target ids, the default value is CONFIG_SYS_SCSI_MAX_SCSI_ID +- max-lun - maximum number of scsi logical units, the default value is CONFIG_SYS_SCSI_MAX_LUN + +SCSI device nodes must be children of the SCSI controller node. \ No newline at end of file -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/7] scsi: call children devices' probe functions automatically
From: Ken Ma- For the purpose of accessing peripheral devices through SCSI, the peripheral devices need to be probed to finish low level initialization, for example, ahci controller needs to do the ahci initialization; - scsi_low_level_init() calling is removed since the detailed scsi low level initialization work is up to the peripheral scsi devices, for example, sata controller may do AHCI initialization while scanner controller may do ISIS initialization; the work should be done in children devices probe when scsi controller acts as bus or be done in the pure SAS controller's probe when SCSI controller is a SAS and works as an on-board component on the motherboard; - Since u-boot initialization does not probe devices by default, SCSI children devices can be probed automatically in SCSI post probe function when SCSI controller acts as a bus. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35426 Tested-by: iSoC Platform CI Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin --- drivers/block/scsi-uclass.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/block/scsi-uclass.c b/drivers/block/scsi-uclass.c index 86eddfc..119ba53 100644 --- a/drivers/block/scsi-uclass.c +++ b/drivers/block/scsi-uclass.c @@ -18,8 +18,26 @@ DECLARE_GLOBAL_DATA_PTR; static int scsi_post_probe(struct udevice *dev) { + struct udevice *child_dev; + int ret; + debug("%s: device %p\n", __func__, dev); - scsi_low_level_init(0, dev); + + /* +* For the purpose of accessing peripheral devices through SCSI, the +* peripheral devices need to be probed to finish low level +* initialization, for example, ahci controller needs to do the ahci +* initialization; +* Since u-boot initialization does not probe devices by default, SCSI +* children devices can be probed automatically in SCSI post probe +* function when SCSI controller acts as a bus. +*/ + list_for_each_entry(child_dev, >child_head, sibling_node) { + ret = device_probe(child_dev); + if (ret) + return ret; + } + return 0; } @@ -54,6 +72,6 @@ UCLASS_DRIVER(scsi) = { .id = UCLASS_SCSI, .name = "scsi", .post_bind = scsi_post_bind, - .post_probe = scsi_post_probe, + .post_probe = scsi_post_probe, .per_device_platdata_auto_alloc_size = sizeof(struct scsi_platdata), }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/7] scsi: move base, max_lun and max_id to uclass plat data
From: Ken Ma- The members in scsi_platdata(base, max_lun and max_id) are generic, so now they are taken from fdt by the uclass_platdata instead of platdata code upon call to post bind callback. Signed-off-by: Ken Ma Cc: Simon Glass Cc: Stefan Roese Cc: Michal Simek Reviewed-on: http://vgitil04.il.marvell.com:8080/35304 Tested-by: iSoC Platform CI Reviewed-by: Omri Itach Reviewed-by: Kostya Porotchkin --- common/scsi.c | 2 +- drivers/block/ahci.c| 2 +- drivers/block/scsi-uclass.c | 29 + 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/common/scsi.c b/common/scsi.c index fb5b407..117c682 100644 --- a/common/scsi.c +++ b/common/scsi.c @@ -574,7 +574,7 @@ int scsi_scan(int mode) return ret; /* Get controller platdata */ - plat = dev_get_platdata(dev); + plat = dev_get_uclass_platdata(dev); for (i = 0; i < plat->max_id; i++) { for (lun = 0; lun < plat->max_lun; lun++) { diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index 3fa14a7..368816e 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -479,7 +479,7 @@ static int ahci_init_one(pci_dev_t dev) pci_write_config_byte(dev, 0x41, 0xa1); #endif #else - struct scsi_platdata *plat = dev_get_platdata(dev); + struct scsi_platdata *plat = dev_get_uclass_platdata(dev); probe_ent->mmio_base = (void *)plat->base; #endif diff --git a/drivers/block/scsi-uclass.c b/drivers/block/scsi-uclass.c index 05da6cd..3bf026b 100644 --- a/drivers/block/scsi-uclass.c +++ b/drivers/block/scsi-uclass.c @@ -11,8 +11,11 @@ #include #include +#include #include +DECLARE_GLOBAL_DATA_PTR; + static int scsi_post_probe(struct udevice *dev) { debug("%s: device %p\n", __func__, dev); @@ -20,8 +23,34 @@ static int scsi_post_probe(struct udevice *dev) return 0; } +static void scsi_ofdata_to_uclass_platdata(struct udevice *dev) +{ + struct scsi_platdata *plat = dev_get_uclass_platdata(dev); + const void *blob = gd->fdt_blob; + int node = dev->of_offset; + + plat->base = (unsigned long)dev_get_addr_ptr(dev); + plat->max_id = fdtdec_get_uint(blob, + node, + "max-id", + CONFIG_SYS_SCSI_MAX_SCSI_ID); + plat->max_lun = fdtdec_get_uint(blob, + node, + "max-lun", + CONFIG_SYS_SCSI_MAX_LUN); + return; +} + +static int scsi_post_bind(struct udevice *dev) +{ + /* Get uclass plat data from fdt */ + scsi_ofdata_to_uclass_platdata(dev); +} + UCLASS_DRIVER(scsi) = { .id = UCLASS_SCSI, .name = "scsi", + .post_bind = scsi_post_bind, .post_probe = scsi_post_probe, + .per_device_platdata_auto_alloc_size = sizeof(struct scsi_platdata), }; -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/7] *** SUBJECT HERE ***
From: Ken Ma <m...@marvell.com> *** BLURB HERE *** 1. Move base, max_lun and max_id such scsi generic data from platdata to uclass plat data; 2. Make scsi compatible for legacy SCSI devices and new SAS controller - Introduce scsi bus DT node, scsi work as bus and scsi disks, scsi scanner and sata are its children scsi device; this is similar to the case that spi bus manages spi flashes; In such case, scsi bus probe should probe its children devices automatically; - SAS controller can also be a scsi node as current. 3. Example with mvebu armada 3700 scsi bus node Ken Ma (7): scsi: move base, max_lun and max_id to uclass plat data scsi: add children devices binding scsi: call children devices' probe functions automatically scsi: dt-bindings: add scsi device tree bindings scsi: mvebu: add scsi driver scsi: a3700: enable mvebu scsi driver scsi: dts: a3700: add scsi node arch/arm/dts/armada-3720-db.dts| 4 ++ arch/arm/dts/armada-37xx.dtsi | 16 +-- common/scsi.c | 2 +- configs/mvebu_db-88f3720_defconfig | 2 + .../scsi/marvell,mvebu-scsi.txt| 29 doc/device-tree-bindings/scsi/scsi-bus.txt | 22 + drivers/block/Kconfig | 10 drivers/block/Makefile | 1 + drivers/block/ahci.c | 2 +- drivers/block/mvebu_scsi.c | 31 + drivers/block/scsi-uclass.c| 54 +- 11 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 doc/device-tree-bindings/scsi/marvell,mvebu-scsi.txt create mode 100644 doc/device-tree-bindings/scsi/scsi-bus.txt create mode 100644 drivers/block/mvebu_scsi.c -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot