spi: kirkwood_spi: implement mvebu_spi_set_mode()
Subsystems (2)
PATCH 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Set the appropriate bits in the interface config register based on the SPI_ mode flags.
---
arch/arm/include/asm/arch-mvebu/spi.h | 4 ++++ drivers/spi/kirkwood_spi.c | 13 +++++++++++++ 2 files changed, 17 insertions(+)
arch/arm/include/asm/arch-mvebu/spi.h +4 -0
@@ -52,6 +52,10 @@ struct kwspi_registers {#define KWSPI_ADRLEN_3BYTE (2 << 8)#define KWSPI_ADRLEN_4BYTE (3 << 8)#define KWSPI_ADRLEN_MASK (3 << 8) +#define KWSPI_CPOL (1 << 11) +#define KWSPI_CPHA (1 << 12) +#define KWSPI_TXLSBF (1 << 13) +#define KWSPI_RXLSBF (1 << 14)#define KWSPI_IRQUNMASK 1/* unmask SPI interrupt */ #define KWSPI_IRQMASK 0/* mask SPI interrupt */
drivers/spi/kirkwood_spi.c +13 -0
@@ -271,6 +271,19 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)static int mvebu_spi_set_mode (struct udevice *bus,uint mode) { +struct mvebu_spi_platdata *plat =dev_get_platdata (bus); +struct kwspi_registers *reg = plat->spireg; +u32 data =readl (®->cfg); + +if (mode &SPI_CPHA ) + data |=KWSPI_CPHA ; +if (mode &SPI_CPOL ) + data |=KWSPI_CPOL ; +if (mode &SPI_LSB_FIRST ) + data |= (KWSPI_RXLSBF |KWSPI_TXLSBF ); + +writel (data, ®->cfg); +return 0 ; }
Signature · 1 line
2.10.0.479.g7c56b16
PATCH 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Quoted 4 lines · Chris Packham
Set the appropriate bits in the interface config register based on the
SPI_mode flags.Signed-off-by Chris Packham <[email protected]>
Thanks,
Stefan
PATCH 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
In reply to Chris PackhamQuoted 30 lines · Chris Packham
Set the appropriate bits in the interface config register based on the
SPI_mode flags.Signed-off-by Chris Packham <[email protected]>---
arch/arm/include/asm/arch-mvebu/spi.h | 4 ++++ drivers/spi/kirkwood_spi.c | 13 +++++++++++++ 2 files changed, 17 insertions(+)arch/arm/include/asm/arch-mvebu/spi.h +4
-0@@ -52,6 +52,10 @@ struct kwspi_registers {#define KWSPI_ADRLEN_3BYTE (2 << 8)#define KWSPI_ADRLEN_4BYTE (3 << 8)#define KWSPI_ADRLEN_MASK (3 << 8) +#define KWSPI_CPOL (1 << 11) +#define KWSPI_CPHA (1 << 12) +#define KWSPI_TXLSBF (1 << 13) +#define KWSPI_RXLSBF (1 << 14)#define KWSPI_IRQUNMASK 1/* unmask SPI interrupt */ #define KWSPI_IRQMASK 0/* mask SPI interrupt */ drivers/spi/kirkwood_spi.c +0
-0
drivers/spi/kirkwood_spi.c static int mvebu_spi_set_speed(struct udevice *bus, uint hz) · line 276
Quoted 6 lines
drivers/spi/kirkwood_spi.c +3
-0@@ -271,6 +271,19 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)static int mvebu_spi_set_mode (struct udevice *bus,uint mode) { +struct mvebu_spi_platdata *plat =dev_get_platdata (bus); +struct kwspi_registers *reg = plat->spireg; +u32 data =readl (®->cfg);
Better to clear the bits(mask) on data before updating,
thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.
PATCH v2 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Set the appropriate bits in the interface config register based on the SPI_ mode flags.
---
Changes in v2:
- Clear bits before updating
arch/arm/include/asm/arch-mvebu/spi.h | 4 ++++ drivers/spi/kirkwood_spi.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+)
arch/arm/include/asm/arch-mvebu/spi.h +4 -0
@@ -52,6 +52,10 @@ struct kwspi_registers {#define KWSPI_ADRLEN_3BYTE (2 << 8)#define KWSPI_ADRLEN_4BYTE (3 << 8)#define KWSPI_ADRLEN_MASK (3 << 8) +#define KWSPI_CPOL (1 << 11) +#define KWSPI_CPHA (1 << 12) +#define KWSPI_TXLSBF (1 << 13) +#define KWSPI_RXLSBF (1 << 14)#define KWSPI_IRQUNMASK 1/* unmask SPI interrupt */ #define KWSPI_IRQMASK 0/* mask SPI interrupt */
drivers/spi/kirkwood_spi.c +15 -0
@@ -271,6 +271,21 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)static int mvebu_spi_set_mode (struct udevice *bus,uint mode) { +struct mvebu_spi_platdata *plat =dev_get_platdata (bus); +struct kwspi_registers *reg = plat->spireg; +u32 data =readl (®->cfg); + + data &= ~(KWSPI_CPHA |KWSPI_CPOL |KWSPI_RXLSBF |KWSPI_TXLSBF ); + +if (mode &SPI_CPHA ) + data |=KWSPI_CPHA ; +if (mode &SPI_CPOL ) + data |=KWSPI_CPOL ; +if (mode &SPI_LSB_FIRST ) + data |= (KWSPI_RXLSBF |KWSPI_TXLSBF ); + +writel (data, ®->cfg); +return 0 ; }
Signature · 1 line
2.10.1
Jagan Teki
AppliedPATCH v2 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Quoted 4 lines · Chris Packham
Set the appropriate bits in the interface config register based on the
SPI_mode flags.Signed-off-by Chris Packham <[email protected]>
Missed updating Stefan Reviewed-by tag? please check for next time.
Quoted 4 lines
---
Changes in v2:
- Clear bits before updating
Applied, thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.
PATCH v2 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Quoted 2 lines · Jagan Teki
On Thu, Oct 27, 2016 at 1:46 PM, Chris Packham <[email protected]>
Quoted 6 lines · wrote:
Quoted 4 lines
Set the appropriate bits in the interface config register based on the
SPI_mode flags.Signed-off-by Chris Packham <[email protected]>Missed updating Stefan Reviewed-by tag? please check for next time.
That was semi-intentional. I thought v2 was different enough that I didn't want to assume Stefan's review would carry through.
Quoted 13 lines
Quoted 5 lines
---
Changes in v2:
- Clear bits before updatingApplied, thanks!
--
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
PATCH v2 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Quoted 8 lines · Chris Packham
Quoted 2 lines · On 27/10/2016 10:41 PM, "Jagan Teki" <[email protected]…
On Thu, Oct 27, 2016 at 1:46 PM, Chris Packham
Quoted 3 lines · <judge.packham at gmail.com <mailto:[email protected]>> wrote:
Quoted 3 lines
Set the appropriate bits in the interface config register based on the
SPI_mode flags.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Chris Packham <[email protected]<mailto:[email protected]>>
Quoted 2 lines
Missed updating Stefan Reviewed-by tag? please check for next time.
That was semi-intentional. I thought v2 was different enough that I didn't want to assume Stefan's review would carry through.
Fair enough. I've overlooked the clearing of the bits spotted by Jagan. Please add my Reviewed-by now as well.
Thanks,
Stefan
PATCH v2 1/1 spi: kirkwood_spi: implement mvebu_spi_set_mode()
Quoted 21 lines · Stefan Roese
Quoted 20 lines · Chris Packham
Quoted 3 lines · On 27/10/2016 10:41 PM, "Jagan Teki" <[email protected]…
On Thu, Oct 27, 2016 at 1:46 PM, Chris Packham
Quoted 5 lines · <judge.packham at gmail.com <mailto:[email protected]>> wrote:
Quoted 5 lines
Set the appropriate bits in the interface config register based on the
SPI_mode flags.Signed-off-by Chris Packham <[email protected]<mailto:[email protected]>>
Quoted 3 lines
Missed updating Stefan Reviewed-by tag? please check for next time.
Quoted 6 lines
Quoted 2 lines
That was semi-intentional. I thought v2 was different enough that I didn't want to assume Stefan's review would carry through.
Fair enough. I've overlooked the clearing of the bits spotted by Jagan. Please add my Reviewed-by now as well.
Yeah, added and applied!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.