drivers: add NPCM8XX support to RNG and USB Host drivers
Subsystems (5)
Tomer Maimon
maintainerPATCH 1/5 usb: host: npcm7xx: remove USB EHCI host reset sequence
In reply to Tomer MaimonRemove USB EHCI host controller reset sequence from NPCM7XX USB EHCI host probe function because it is done in the NPCM reset driver.
--- drivers/usb/host/ehci-npcm7xx.c | 50 --------------------------------- 1 file changed, 50 deletions(-)
drivers/usb/host/ehci-npcm7xx.c +0 -50
@@ -22,19 +22,9 @@#include "ehci.h" -#include <linux/regmap.h> -#include <linux/mfd/syscon.h> -#define DRIVER_DESC "EHCI npcm7xx driver"static const char hcd_name[] ="npcm7xx-ehci" ; - -#define USB2PHYCTL_OFFSET 0x144 - -#define IPSRST2_OFFSET 0x24 -#define IPSRST3_OFFSET 0x34 - -static struct hc_driver __read_mostly ehci_npcm7xx_hc_driver;static int __maybe_unused ehci_npcm7xx_drv_suspend (struct device *dev)
@@ -60,52 +50,12 @@ static int npcm7xx_ehci_hcd_drv_probe(struct platform_device *pdev) {struct usb_hcd *hcd;struct resource *res; -struct regmap *gcr_regmap; -struct regmap *rst_regmap;const struct hc_driver *driver = &ehci_npcm7xx_hc_driver;int irq;int retval;dev_dbg (&pdev->dev,"initializing npcm7xx ehci USB Controller\n" ); - gcr_regmap =syscon_regmap_lookup_by_compatible ("nuvoton,npcm750-gcr" ); -if (IS_ERR (gcr_regmap)) { -dev_err (&pdev->dev,"%s: failed to find nuvoton,npcm750-gcr\n" , - __func__); -return PTR_ERR (gcr_regmap); - } - - rst_regmap =syscon_regmap_lookup_by_compatible ("nuvoton,npcm750-rst" ); -if (IS_ERR (rst_regmap)) { -dev_err (&pdev->dev,"%s: failed to find nuvoton,npcm750-rst\n" , - __func__); -return PTR_ERR (rst_regmap); - } - -/********* phy init ******/ -// reset usb host -regmap_update_bits (rst_regmap,IPSRST2_OFFSET , - (0x1 <<26 ), (0x1 <<26 )); -regmap_update_bits (rst_regmap,IPSRST3_OFFSET , - (0x1 <<25 ), (0x1 <<25 )); -regmap_update_bits (gcr_regmap,USB2PHYCTL_OFFSET , - (0x1 <<28 ),0 ); - -udelay (1 ); - -// enable phy -regmap_update_bits (rst_regmap,IPSRST3_OFFSET , - (0x1 <<25 ),0 ); - -udelay (50 );// enable phy - -regmap_update_bits (gcr_regmap,USB2PHYCTL_OFFSET , - (0x1 <<28 ), (0x1 <<28 )); - -// enable host -regmap_update_bits (rst_regmap,IPSRST2_OFFSET , - (0x1 <<26 ),0 ); -if (usb_disabled ())return -ENODEV ;
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH 2/5 dt-bindings: usb: npcm7xx: Add npcm845 compatible
In reply to Tomer MaimonAdd a compatible string for Nuvoton BMC NPCM845 USB EHCI host controller.
--- Documentation/devicetree/bindings/usb/npcm7xx-usb.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/npcm7xx-usb.txt +3 -1
@@ -5,7 +5,9 @@ EHCI: ----- Required properties: -- compatible: "nuvoton,npcm750-ehci" +- compatible: should be one of + "nuvoton,npcm750-ehci" + "nuvoton,npcm845-ehci" - interrupts: Should contain the EHCI interrupt - reg: Physical address and length of the register set for the device
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH 4/5 dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible
In reply to Tomer MaimonAdd a compatible string for Nuvoton BMC NPCM845 random number generator.
--- Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt +2 -0
@@ -2,6 +2,8 @@ NPCM SoC Random Number Generator Required properties: - compatible : "nuvoton,npcm750-rng" for the NPCM7XX BMC. + "nuvoton,npcm845-rng" for the NPCM8XX BMC. + - reg : Specifies physical base address and size of the registers. Example:
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH 3/5 USB: host: npcm: Add NPCM8XX support
In reply to Tomer MaimonModify NPCM USB EHCI host controller configuration to support all NPCM BMC SoC.
--- drivers/usb/host/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/Kconfig +4 -4
@@ -205,12 +205,12 @@ config USB_EHCI_FSL Variation of ARC USB block used in some Freescale chips. config USB_EHCI_HCD_NPCM7XX - tristate "Support for Nuvoton NPCM7XX on-chip EHCI USB controller" - depends on (USB_EHCI_HCD && ARCH_NPCM7XX) || COMPILE_TEST - default y if (USB_EHCI_HCD && ARCH_NPCM7XX) + tristate "Support for Nuvoton NPCM on-chip EHCI USB controller" + depends on (USB_EHCI_HCD && ARCH_NPCM) || COMPILE_TEST + default y if (USB_EHCI_HCD && ARCH_NPCM) help Enables support for the on-chip EHCI controller on - Nuvoton NPCM7XX chips. + Nuvoton NPCM chips. config USB_EHCI_HCD_OMAP tristate "EHCI support for OMAP3 and later chips"
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH 5/5 char: hwrng: npcm: Add NPCM8XX support
In reply to Tomer MaimonAdding RNG NPCM8XX support to the NPCM RNG driver. RNG NPCM8XX uses a different clock prescaler.
As part of adding NPCM8XX support:
- Add NPCM8XX specific compatible string.
- Set clock prescaler according to the NPCM BMC SoC.
--- drivers/char/hw_random/npcm-rng.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/char/hw_random/npcm-rng.c +10 -3
@@ -19,6 +19,7 @@#define NPCM_RNGMODE_REG 0x08/* Mode register */ #define NPCM_RNG_CLK_SET_25MHZ GENMASK(4, 3)/* 20-25 MHz */ +#define NPCM_RNG_CLK_SET_62_5MHZ BIT(2)/* 60-80 MHz */ #define NPCM_RNG_DATA_VALID BIT(1)#define NPCM_RNG_ENABLE BIT(0)#define NPCM_RNG_M1ROSEL BIT(1)
@@ -31,14 +32,14 @@struct npcm_rng {void __iomem *base;struct hwrng rng; +u32 clkp; };static int npcm_rng_init (struct hwrng *rng) {struct npcm_rng *priv =to_npcm_rng (rng); -writel (NPCM_RNG_CLK_SET_25MHZ |NPCM_RNG_ENABLE , - priv->base +NPCM_RNGCS_REG ); +writel (priv->clkp |NPCM_RNG_ENABLE , priv->base +NPCM_RNGCS_REG );return 0 ; }
@@ -47,7 +48,7 @@ static void npcm_rng_cleanup(struct hwrng *rng) {struct npcm_rng *priv =to_npcm_rng (rng); -writel (NPCM_RNG_CLK_SET_25MHZ , priv->base +NPCM_RNGCS_REG ); +writel (priv->clkp, priv->base +NPCM_RNGCS_REG ); }static int npcm_rng_read (struct hwrng *rng,void *buf,size_t max,bool wait)
@@ -102,6 +103,11 @@ static int npcm_rng_probe(struct platform_device *pdev)pm_runtime_use_autosuspend (&pdev->dev);pm_runtime_enable (&pdev->dev); +if (of_device_is_compatible (pdev->dev.of_node,"nuvoton,npcm750-rng" )) + priv->clkp =NPCM_RNG_CLK_SET_25MHZ ; +if (of_device_is_compatible (pdev->dev.of_node,"nuvoton,npcm845-rng" )) + priv->clkp =NPCM_RNG_CLK_SET_62_5MHZ ; +#ifndef CONFIG_PM priv->rng.init = npcm_rng_init; priv->rng.cleanup = npcm_rng_cleanup;
@@ -163,6 +169,7 @@ static const struct dev_pm_ops npcm_rng_pm_ops = {static const struct of_device_id rng_dt_id[]__maybe_unused = { { .compatible ="nuvoton,npcm750-rng" , }, + { .compatible ="nuvoton,npcm845-rng" , }, {}, };MODULE_DEVICE_TABLE (of, rng_dt_id);
Signature · 1 line
2.33.0
Tomer Maimon
maintainercover drivers: add NPCM8XX support to RNG and USB Host drivers
This patch set adds Arbel NPCM8XX support to RNG and USB Host drivers.
This patchset was tested on the Arbel NPCM8XX evaluation board that running Arbel OpenBMC.
The USB Host patchset is based on the Arbel NPCM8XX BMC 5.19 kernel patchsets
https://lore.kernel.org/all/[email protected]/
Tomer Maimon (5):
usb: host: npcm7xx: remove USB EHCI host reset sequence
dt-bindings: usb: npcm7xx: Add npcm845 compatible
USB: host: npcm: Add NPCM8XX support
dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible
char: hwrng: npcm: Add NPCM8XX support
.../bindings/rng/nuvoton,npcm-rng.txt | 2 + .../devicetree/bindings/usb/npcm7xx-usb.txt | 4 +- drivers/char/hw_random/npcm-rng.c | 13 +++-- drivers/usb/host/Kconfig | 8 +-- drivers/usb/host/ehci-npcm7xx.c | 50 ------------------- 5 files changed, 19 insertions(+), 58 deletions(-)
Signature · 1 line
2.33.0