Skip to contentSkip to conversation

spi: hsspi: allow to be used on bcm6858 and bcm63158

PATCH New Philippe Reynes 4 participants 26 messages Aug 14, 2019 – Oct 12, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/10 spi: hsspi: allow to be used on bcm6858 and bcm63158

From: Kursad Oney <[email protected]>

This IP exists in both MIPS and ARM cores, so we also allow to use this driver on bcm6858 and bcm63158.

---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changelog:
v3:
- no change
v2:
- add dependancy on bcm6858 and bcm63158 instead of removing mips dependancy (thanks Daniel)

drivers/spi/Kconfig +1 -1
index f459c0a..932d2d9 100644
@@ -67,7 +67,7 @@ config ATMEL_SPI
 
 config BCM63XX_HSSPI
 	bool "BCM63XX HSSPI driver"
-	depends on ARCH_BMIPS
+	depends on (ARCH_BMIPS || ARCH_BCM6858 || ARCH_BCM63158)
 	help
 	  Enable the BCM6328 HSSPI driver. This driver can be used to
 	  access the SPI NOR flash on platforms embedding this Broadcom
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

---
 include/wait_bit.h | 2 ++
 1 file changed, 2 insertions(+)

Changelog:
v3:
- avoid double definition when readw_be/readl_be is defined v2:
- move this patch from third place to second place

include/wait_bit.h +2 -0
index 82e09da..79da081 100644
@@ -72,10 +72,12 @@ static inline int wait_for_bit_##sfx(const void *reg,			\
 
 BUILD_WAIT_FOR_BIT(8, u8, readb)
 BUILD_WAIT_FOR_BIT(le16, u16, readw)
+BUILD_WAIT_FOR_BIT(16, u16, readw)
 #ifdef readw_be
 BUILD_WAIT_FOR_BIT(be16, u16, readw_be)
 #endif
 BUILD_WAIT_FOR_BIT(le32, u32, readl)
+BUILD_WAIT_FOR_BIT(32, u32, readl)
 #ifdef readl_be
 BUILD_WAIT_FOR_BIT(be32, u32, readl_be)
 #endif
Signature · 1 line
2.7.4
maintainer
#2 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

Hi Daniel,

Quoted 37 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

---
 include/wait_bit.h | 2 ++
 1 file changed, 2 insertions(+)

Changelog:
v3:
- avoid double definition when readw_be/readl_be is defined v2:
- move this patch from third place to second place

include/wait_bit.h +2 -1
index 82e09da..79da081 100644
@@ -72,10 +72,12 @@ static inline int wait_for_bit_##sfx(const void *reg,                       \
 
 BUILD_WAIT_FOR_BIT(8, u8, readb)
 BUILD_WAIT_FOR_BIT(le16, u16, readw)
+BUILD_WAIT_FOR_BIT(16, u16, readw)
 #ifdef readw_be
 BUILD_WAIT_FOR_BIT(be16, u16, readw_be)
 #endif
 BUILD_WAIT_FOR_BIT(le32, u32, readl)
+BUILD_WAIT_FOR_BIT(32, u32, readl)
 #ifdef readl_be
 BUILD_WAIT_FOR_BIT(be32, u32, readl_be)
 #endif
--
Quoted 2 lines

2.7.4

Philippe and I have a question about the wait_for_bit macros for MIPS if you don't mind.

It seems in the current code, wait_for_bit_le32 seems to default to readl for MIPS and
wait_for_bit_le16 to readw. Is this correct? If so, our wait_for_bit_32 macro would default
to LE on MIPS and we need to change that. However, readl seems like it would default
to host endianness. Can you help us out?

Thanks!
kursad

#3 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

Am 14.08.19 um 15:29 schrieb Kursad Oney:

Quoted 47 lines

Hi Daniel,

Quoted 37 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

---
 include/wait_bit.h | 2 ++
 1 file changed, 2 insertions(+)

Changelog:
v3:
- avoid double definition when readw_be/readl_be is defined v2:
- move this patch from third place to second place

include/wait_bit.h +2 -1
index 82e09da..79da081 100644
@@ -72,10 +72,12 @@ static inline int wait_for_bit_##sfx(const void *reg,                       \
 
 BUILD_WAIT_FOR_BIT(8, u8, readb)
 BUILD_WAIT_FOR_BIT(le16, u16, readw)
+BUILD_WAIT_FOR_BIT(16, u16, readw)
 #ifdef readw_be
 BUILD_WAIT_FOR_BIT(be16, u16, readw_be)
 #endif
 BUILD_WAIT_FOR_BIT(le32, u32, readl)
+BUILD_WAIT_FOR_BIT(32, u32, readl)
 #ifdef readl_be
 BUILD_WAIT_FOR_BIT(be32, u32, readl_be)
 #endif
--
Quoted 2 lines

2.7.4

Philippe and I have a question about the wait_for_bit macros for MIPS if you don't mind.

Quoted 8 lines

It seems in the current code, wait_for_bit_le32 seems to default to readl for MIPS and
wait_for_bit_le16 to readw. Is this correct? If so, our wait_for_bit_32 macro would default
to LE on MIPS and we need to change that. However, readl seems like it would default
to host endianness. Can you help us out?

A readl on MIPS is effectively a __raw_readl, it doesn't force LE. But there is one exception: if a CPU/board selects CONFIG_SWAP_IO_SPACE, readl/writel will swap to the opposite endianess of the CPU. But you don't need to worry about that because that's only used on old hardware together with PCI/ISA and it's only enabled on MIPS Malta board.

So your change will work on MIPS in almost all cases because a wait_for_bit_32 isn't expected to swap. The only problem would be if the CPU operates in BE, the peripheral in LE and the bus system doesn't swap in hardware. Then the already existing wait_for_bit_le[16|32] wouldn't work as expected because LE isn't enforced. This could only be solved when wait_for_bit would use the in_[le|be][16|32|64] primitives. But this could be addressed when someone wants to support such a system ;)

Signature · 1 line
- Daniel
maintainer
#4 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

Hi Daniel,

Quoted 74 lines · Daniel Schwierzeck

Am 14.08.19 um 15:29 schrieb Kursad Oney:

Quoted 47 lines

Hi Daniel,

Quoted 37 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

---
 include/wait_bit.h | 2 ++
 1 file changed, 2 insertions(+)

Changelog:
v3:
- avoid double definition when readw_be/readl_be is defined v2:
- move this patch from third place to second place

include/wait_bit.h +2 -1
index 82e09da..79da081 100644
@@ -72,10 +72,12 @@ static inline int wait_for_bit_##sfx(const void *reg,                       \
 
 BUILD_WAIT_FOR_BIT(8, u8, readb)
 BUILD_WAIT_FOR_BIT(le16, u16, readw)
+BUILD_WAIT_FOR_BIT(16, u16, readw)
 #ifdef readw_be
 BUILD_WAIT_FOR_BIT(be16, u16, readw_be)
 #endif
 BUILD_WAIT_FOR_BIT(le32, u32, readl)
+BUILD_WAIT_FOR_BIT(32, u32, readl)
 #ifdef readl_be
 BUILD_WAIT_FOR_BIT(be32, u32, readl_be)
 #endif
--
Quoted 2 lines

2.7.4

Philippe and I have a question about the wait_for_bit macros for MIPS if you don't mind.

Quoted 8 lines

It seems in the current code, wait_for_bit_le32 seems to default to readl for MIPS and
wait_for_bit_le16 to readw. Is this correct? If so, our wait_for_bit_32 macro would default
to LE on MIPS and we need to change that. However, readl seems like it would default
to host endianness. Can you help us out?

A readl on MIPS is effectively a __raw_readl, it doesn't force LE. But there is one exception: if a CPU/board selects CONFIG_SWAP_IO_SPACE, readl/writel will swap to the opposite endianess of the CPU. But you don't need to worry about that because that's only used on old hardware together with PCI/ISA and it's only enabled on MIPS Malta board.

So your change will work on MIPS in almost all cases because a wait_for_bit_32 isn't expected to swap. The only problem would be if the CPU operates in BE, the peripheral in LE and the bus system doesn't swap in hardware. Then the already existing wait_for_bit_le[16|32] wouldn't work as expected because LE isn't enforced. This could only be solved when wait_for_bit would use the in_[le|be][16|32|64] primitives. But this could be addressed when someone wants to support such a system ;)

Quoted 2 lines

--
- Daniel

Great! Thank you for the explanation!
kursad

#5 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

In reply to Philippe Reynes

Am 14.08.19 um 15:18 schrieb Philippe Reynes:

Quoted 12 lines

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

---
 include/wait_bit.h | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

Changelog:
v3:
- avoid double definition when readw_be/readl_be is defined v2:
- move this patch from third place to second place

Signature · 1 line
- Daniel
#6 lore raw

PATCH v3 2/10 waitbit: Add the generic wait_for_bit macros for 16 and 32 bits.

In reply to Philippe Reynes
Quoted 9 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

wait_for_bit_le32 and wait_for_bit_le16 use the raw I/O functions which would default to big-endian on BE systems. Create the generic equivalents to use the native endianness.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/fe3aac21/attachment.sig>
#7 lore raw

PATCH v3 3/10 spi: bcm63xx_hsspi: switch to raw I/O functions.

In reply to Philippe Reynes

From: Kursad Oney <[email protected]>

Make the driver compatible with both big and little endian SOCs. Replace big-endian calls with their raw equivalents, expect for writing the command to FIFO. That still has to be in big-endian format.

---
 drivers/spi/bcm63xx_hsspi.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Changelog:
v3:
- no change
v2:
- move this patch from second place to third place

drivers/spi/bcm63xx_hsspi.c +14 -14
index 4f527fa7..7306531 100644
@@ -120,9 +120,9 @@ static int bcm63xx_hsspi_set_mode(struct udevice *bus, uint mode)
 
 	/* clock polarity */
 	if (mode & SPI_CPOL)
-		setbits_be32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_POL_MASK);
+		setbits_32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_POL_MASK);
 	else
-		clrbits_be32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_POL_MASK);
+		clrbits_32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_POL_MASK);
 
 	return 0;
 }
@@ -146,7 +146,7 @@ static void bcm63xx_hsspi_activate_cs(struct bcm63xx_hsspi_priv *priv,
 	set = DIV_ROUND_UP(2048, set);
 	set &= SPI_PFL_CLK_FREQ_MASK;
 	set |= SPI_PFL_CLK_RSTLOOP_MASK;
-	writel_be(set, priv->regs + SPI_PFL_CLK_REG(plat->cs));
+	writel(set, priv->regs + SPI_PFL_CLK_REG(plat->cs));
 
 	/* profile signal */
 	set = 0;
@@ -164,7 +164,7 @@ static void bcm63xx_hsspi_activate_cs(struct bcm63xx_hsspi_priv *priv,
 	if (priv->speed > SPI_MAX_SYNC_CLOCK)
 		set |= SPI_PFL_SIG_ASYNCIN_MASK;
 
-	clrsetbits_be32(priv->regs + SPI_PFL_SIG_REG(plat->cs), clr, set);
+	clrsetbits_32(priv->regs + SPI_PFL_SIG_REG(plat->cs), clr, set);
 
 	/* global control */
 	set = 0;
@@ -182,13 +182,13 @@ static void bcm63xx_hsspi_activate_cs(struct bcm63xx_hsspi_priv *priv,
 	else
 		set |= BIT(!plat->cs);
 
-	clrsetbits_be32(priv->regs + SPI_CTL_REG, clr, set);
+	clrsetbits_32(priv->regs + SPI_CTL_REG, clr, set);
 }
 
 static void bcm63xx_hsspi_deactivate_cs(struct bcm63xx_hsspi_priv *priv)
 {
 	/* restore cs polarities */
-	clrsetbits_be32(priv->regs + SPI_CTL_REG, SPI_CTL_CS_POL_MASK,
+	clrsetbits_32(priv->regs + SPI_CTL_REG, SPI_CTL_CS_POL_MASK,
 			priv->cs_pols);
 }
 
@@ -247,7 +247,7 @@ static int bcm63xx_hsspi_xfer(struct udevice *dev, unsigned int bitlen,
 	      SPI_PFL_MODE_MDWRSZ_MASK;
 	if (plat->mode & SPI_3WIRE)
 		val |= SPI_PFL_MODE_3WIRE_MASK;
-	writel_be(val, priv->regs + SPI_PFL_MODE_REG(plat->cs));
+	writel(val, priv->regs + SPI_PFL_MODE_REG(plat->cs));
 
 	/* transfer loop */
 	while (data_bytes > 0) {
@@ -262,7 +262,7 @@ static int bcm63xx_hsspi_xfer(struct udevice *dev, unsigned int bitlen,
 		}
 
 		/* set fifo operation */
-		writew_be(opcode | (curr_step & HSSPI_FIFO_OP_BYTES_MASK),
+		writew(cpu_to_be16(opcode | (curr_step & HSSPI_FIFO_OP_BYTES_MASK)),
 			  priv->regs + HSSPI_FIFO_OP_REG);
 
 		/* issue the transfer */
@@ -271,10 +271,10 @@ static int bcm63xx_hsspi_xfer(struct udevice *dev, unsigned int bitlen,
 		       SPI_CMD_PFL_MASK;
 		val |= (!plat->cs << SPI_CMD_SLAVE_SHIFT) &
 		       SPI_CMD_SLAVE_MASK;
-		writel_be(val, priv->regs + SPI_CMD_REG);
+		writel(val, priv->regs + SPI_CMD_REG);
 
 		/* wait for completion */
-		ret = wait_for_bit_be32(priv->regs + SPI_STAT_REG,
+		ret = wait_for_bit_32(priv->regs + SPI_STAT_REG,
 					SPI_STAT_SRCBUSY_MASK, false,
 					1000, false);
 		if (ret) {
@@ -381,16 +381,16 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
 		return ret;
 
 	/* initialize hardware */
-	writel_be(0, priv->regs + SPI_IR_MASK_REG);
+	writel(0, priv->regs + SPI_IR_MASK_REG);
 
 	/* clear pending interrupts */
-	writel_be(SPI_IR_CLEAR_ALL, priv->regs + SPI_IR_STAT_REG);
+	writel(SPI_IR_CLEAR_ALL, priv->regs + SPI_IR_STAT_REG);
 
 	/* enable clk gate */
-	setbits_be32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_GATE_MASK);
+	setbits_32(priv->regs + SPI_CTL_REG, SPI_CTL_CLK_GATE_MASK);
 
 	/* read default cs polarities */
-	priv->cs_pols = readl_be(priv->regs + SPI_CTL_REG) &
+	priv->cs_pols = readl(priv->regs + SPI_CTL_REG) &
 			SPI_CTL_CS_POL_MASK;
 
 	return 0;
Signature · 1 line
2.7.4
#8 lore raw

PATCH v3 3/10 spi: bcm63xx_hsspi: switch to raw I/O functions.

Am 14.08.19 um 15:18 schrieb Philippe Reynes:

Quoted 13 lines

From: Kursad Oney <[email protected]>

Make the driver compatible with both big and little endian SOCs. Replace big-endian calls with their raw equivalents, expect for writing the command to FIFO. That still has to be in big-endian format.

---
 drivers/spi/bcm63xx_hsspi.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
Quoted 6 lines

Changelog:
v3:
- no change
v2:
- move this patch from second place to third place

Signature · 1 line
- Daniel
#9 lore raw

PATCH v3 3/10 spi: bcm63xx_hsspi: switch to raw I/O functions.

In reply to Philippe Reynes
Quoted 10 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

Make the driver compatible with both big and little endian SOCs. Replace big-endian calls with their raw equivalents, expect for writing the command to FIFO. That still has to be in big-endian format.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/dd25e47a/attachment.sig>
#10 lore raw

PATCH v3 4/10 spi: bcm63xx_hsspi: Continue init when using no reset and fixed-clock.

In reply to Philippe Reynes

From: Kursad Oney <[email protected]>

The Broadcom ARM implementations do not yet have a clock framework so one can use a fixed clock as the root clock of the hsspi block. The fixed clock does not have an "enable" routine, since it's always enabled. So when we hit this issue, getting an ENOSYS return, do not bail but continue initialization.

Similarly the block might already have been out of reset, say, when we are booting from a SPI device. So if the reset signal is not configured in the device tree, do not bail out and instead skip deasserting the reset.

---
 drivers/spi/bcm63xx_hsspi.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Changelog:
v3:
- no change
v2:
- no change

drivers/spi/bcm63xx_hsspi.c +9 -10
index 7306531..e82b80c 100644
@@ -349,32 +349,31 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
 		return ret;
 
 	ret = clk_enable(&clk);
-	if (ret < 0)
+	if (ret < 0 && ret != -ENOSYS)
 		return ret;
 
 	ret = clk_free(&clk);
-	if (ret < 0)
+	if (ret < 0 && ret != -ENOSYS)
 		return ret;
 
 	/* get clock rate */
 	ret = clk_get_by_name(dev, "pll", &clk);
-	if (ret < 0)
+	if (ret < 0 && ret != -ENOSYS)
 		return ret;
 
 	priv->clk_rate = clk_get_rate(&clk);
 
 	ret = clk_free(&clk);
-	if (ret < 0)
+	if (ret < 0 && ret != -ENOSYS)
 		return ret;
 
 	/* perform reset */
 	ret = reset_get_by_index(dev, 0, &rst_ctl);
-	if (ret < 0)
-		return ret;
-
-	ret = reset_deassert(&rst_ctl);
-	if (ret < 0)
-		return ret;
+	if (ret >= 0) {
+		ret = reset_deassert(&rst_ctl);
+		if (ret < 0)
+			return ret;
+	}
 
 	ret = reset_free(&rst_ctl);
 	if (ret < 0)
Signature · 1 line
2.7.4
#11 lore raw

PATCH v3 4/10 spi: bcm63xx_hsspi: Continue init when using no reset and fixed-clock.

Quoted 8 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

The Broadcom ARM implementations do not yet have a clock framework so one can use a fixed clock as the root clock of the hsspi block. The fixed clock does not have an "enable" routine, since it's always enabled. So when we hit this issue, getting an ENOSYS return, do not bail but continue initialization.

Quoted 6 lines

Similarly the block might already have been out of reset, say, when we are booting from a SPI device. So if the reset signal is not configured in the device tree, do not bail out and instead skip deasserting the reset.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/1cbc7c2e/attachment.sig>
#12 lore raw

PATCH v3 5/10 dt: bcm63158: Add hsspi controller

In reply to Philippe Reynes

From: Kursad Oney <[email protected]>

This change adds the hsspi controller to the 63158 dtsi.

---
 arch/arm/dts/bcm63158.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

arch/arm/dts/bcm63158.dtsi +25 -0
index 175af38..7dd2858 100644
@@ -10,6 +10,10 @@
 	#address-cells = <2>;
 	#size-cells = <2>;
 
+	aliases {
+		spi0 = &hsspi;
+	};
+
 	cpus {
 		#address-cells = <2>;
 		#size-cells = <0>;
@@ -67,6 +71,14 @@
 			u-boot,dm-pre-reloc;
 		};
 
+		hsspi_pll: hsspi-pll {
+			compatible = "fixed-factor-clock";
+			#clock-cells = <0>;
+			clocks = <&periph_osc>;
+			clock-mult = <2>;
+			clock-div = <1>;
+		};
+
 		refclk50mhz: refclk50mhz {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
@@ -192,6 +204,19 @@
 			status = "disabled";
 		};
 
+		hsspi: spi-controller at ff801000 {
+			compatible = "brcm,bcm6328-hsspi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x0 0xff801000 0x0 0x600>;
+			clocks = <&hsspi_pll>, <&hsspi_pll>;
+			clock-names = "hsspi", "pll";
+			spi-max-frequency = <100000000>;
+			num-cs = <8>;
+
+			status = "disabled";
+		};
+
 		nand: nand-controller at ff801800 {
 			compatible = "brcm,nand-bcm63158",
 				     "brcm,brcmnand-v5.0",
Signature · 1 line
2.7.4
#13 lore raw

PATCH v3 5/10 dt: bcm63158: Add hsspi controller

Quoted 6 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

This change adds the hsspi controller to the 63158 dtsi.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/14b1aea0/attachment.sig>
#14 lore raw

PATCH v3 6/10 dt: bcm963158: add a spi-nor device

In reply to Philippe Reynes

From: Kursad Oney <[email protected]>

This change adds a spi nor flash device to the bcm963158 board.

---
 arch/arm/dts/bcm963158.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

arch/arm/dts/bcm963158.dts +12 -0
index 8565944..c2bdd33 100644
@@ -125,3 +125,15 @@
 		label = "green:aggregate_link";
 	};
 };
+
+&hsspi {
+	status = "okay";
+
+	flash: mt25 at 0 {
+		compatible = "jedec,spi-nor";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+	};
+};
Signature · 1 line
2.7.4
#15 lore raw

PATCH v3 6/10 dt: bcm963158: add a spi-nor device

Quoted 6 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

This change adds a spi nor flash device to the bcm963158 board.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/542d2a1e/attachment.sig>
#16 lore raw

PATCH v3 7/10 configs: Add hsspi/spi support to bcm963158.

In reply to Philippe Reynes

From: Kursad Oney <[email protected]>

This commit enable the support of the spi-nor for the broadcom reference board bcm963158.

---
 configs/bcm963158_ram_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

configs/bcm963158_ram_defconfig +7 -0
index 5eafbaa..825d5a4 100644
@@ -22,6 +22,7 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_SF=y
 CONFIG_CMD_CACHE=y
 CONFIG_DOS_PARTITION=y
 CONFIG_ISO_PARTITION=y
@@ -40,12 +41,18 @@ CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_BRCMNAND=y
 CONFIG_NAND_BRCMNAND_63158=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_CONS_INDEX=0
 CONFIG_DM_SERIAL=y
 CONFIG_SERIAL_SEARCH_ALL=y
 CONFIG_PL01X_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_BCM63XX_HSSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_WDT_BCM6345=y
Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 7/10 configs: Add hsspi/spi support to bcm963158.

Quoted 7 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

This commit enable the support of the spi-nor for the broadcom reference board bcm963158.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/05780467/attachment.sig>
#18 lore raw

PATCH v3 8/10 dt: bcm6858: add hsspi controller

In reply to Philippe Reynes

This commit add a hsspi controller in the bcm6858 device tree.

---
 arch/arm/dts/bcm6858.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

arch/arm/dts/bcm6858.dtsi +25 -0
index 91f7787..0222562 100644
@@ -10,6 +10,10 @@
 	#address-cells = <2>;
 	#size-cells = <2>;
 
+	aliases {
+		spi0 = &hsspi;
+	};
+
 	cpus {
 		#address-cells = <2>;
 		#size-cells = <0>;
@@ -67,6 +71,14 @@
 			u-boot,dm-pre-reloc;
 		};
 
+		hsspi_pll: hsspi-pll {
+			compatible = "fixed-factor-clock";
+			#clock-cells = <0>;
+			clocks = <&periph_osc>;
+			clock-mult = <2>;
+			clock-div = <1>;
+		};
+
 		refclk50mhz: refclk50mhz {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
@@ -192,6 +204,19 @@
 			status = "disabled";
 		};
 
+		hsspi: spi-controller at ff801000 {
+			compatible = "brcm,bcm6328-hsspi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x0 0xff801000 0x0 0x600>;
+			clocks = <&hsspi_pll>, <&hsspi_pll>;
+			clock-names = "hsspi", "pll";
+			spi-max-frequency = <100000000>;
+			num-cs = <8>;
+
+			status = "disabled";
+		};
+
 		nand: nand-controller at ff801800 {
 			compatible = "brcm,nand-bcm6858",
 				     "brcm,brcmnand-v5.0",
Signature · 1 line
2.7.4
#19 lore raw

PATCH v3 8/10 dt: bcm6858: add hsspi controller

Quoted 4 lines · Philippe Reynes

This commit add a hsspi controller in the bcm6858 device tree.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/58ed1dea/attachment.sig>
#20 lore raw

PATCH v3 9/10 dt: bcm968580xref: add a spi-nor device

In reply to Philippe Reynes

This commit add a spi-nor device in the bcm96850xref device tree.

---
 arch/arm/dts/bcm968580xref.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

arch/arm/dts/bcm968580xref.dts +12 -0
index 861e989..a034e38 100644
@@ -124,3 +124,15 @@
 		label = "green:wps";
 	};
 };
+
+&hsspi {
+	status = "okay";
+
+	flash: mt25 at 0 {
+		compatible = "jedec,spi-nor";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+	};
+};
Signature · 1 line
2.7.4
#21 lore raw

PATCH v3 9/10 dt: bcm968580xref: add a spi-nor device

Quoted 4 lines · Philippe Reynes

This commit add a spi-nor device in the bcm96850xref device tree.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/cd803bb5/attachment.sig>
#22 lore raw

PATCH v3 10/10 bcm968580xref: enable spi-nor support

In reply to Philippe Reynes

This commit enable the support of the spi-nor for the broadcom reference board bcm968580xref.

---
 configs/bcm968580xref_ram_defconfig | 9 +++++++++
 1 file changed, 9 insertions(+)

Changelog:
v3:
- no change
v2:
- no change

configs/bcm968580xref_ram_defconfig +9 -0
index 49731ee..4bc501f 100644
@@ -18,6 +18,8 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
 CONFIG_CMD_PART=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
 CONFIG_DOS_PARTITION=y
 CONFIG_ISO_PARTITION=y
 CONFIG_EFI_PARTITION=y
@@ -35,12 +37,19 @@ CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_BRCMNAND=y
 CONFIG_NAND_BRCMNAND_6858=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_CONS_INDEX=0
 CONFIG_DM_SERIAL=y
 CONFIG_SERIAL_SEARCH_ALL=y
 CONFIG_BCM6345_SERIAL=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_BCM63XX_HSSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_WDT_BCM6345=y
Signature · 1 line
2.7.4
#23 lore raw

PATCH v3 10/10 bcm968580xref: enable spi-nor support

Quoted 5 lines · Philippe Reynes

This commit enable the support of the spi-nor for the broadcom reference board bcm968580xref.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/cdc7cb55/attachment.sig>
#24 lore raw

PATCH v3 1/10 spi: hsspi: allow to be used on bcm6858 and bcm63158

In reply to Philippe Reynes

Am 14.08.19 um 15:18 schrieb Philippe Reynes:

Quoted 11 lines

From: Kursad Oney <[email protected]>

This IP exists in both MIPS and ARM cores, so we also allow to use this driver on bcm6858 and bcm63158.

---
 drivers/spi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines

Changelog:
v3:
- no change
v2:
- add dependancy on bcm6858 and bcm63158 instead of removing mips dependancy (thanks Daniel)

Signature · 1 line
- Daniel
#25 lore raw

PATCH v3 1/10 spi: hsspi: allow to be used on bcm6858 and bcm63158

In reply to Philippe Reynes
Quoted 8 lines · Philippe Reynes

From: Kursad Oney <[email protected]>

This IP exists in both MIPS and ARM cores, so we also allow to use this driver on bcm6858 and bcm63158.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/e3736483/attachment.sig>