[v2, 2/4] mtd: spi-nor: Add Octal SPI support to Cadence QSPI driver.

Artur Jedrysek jartur at cadence.com
Fri Mar 10 06:22:11 PST 2017


From: Marek Vasut [mailto:marek.vasut at gmail.com]
Sent: 10 marca 2017 15:15

> On 03/10/2017 03:09 PM, Artur Jedrysek wrote:
> 
> CCing Dinh.
> 
> [...]
> 
> >>>>> +	/* Determine, whether or not octal transfer MAY be supported */
> >>>>
> >>>> But you already know that from DT, no ?
> >>>>
> >>>
> >>> Cadence Octal (formerly Quad) SPI Controller is sold as an IP, and is
> >>> configurable. This includes max SPI mode. It is possible to detect, that
> >>> Octal SPI controller is configured (during hardware compilation) to support
> >>> up to Quad mode, using revision register.
> >>
> >> So the octal-spi controller always has this config register, but the
> >> quad-spi controller may or may not have this register ?
> >>
> >
> > This register was always present. In Quad-SPI, however, it didn't contain
> > information about maximum possible mode, as only quad was possible, and
> > meaning of bits checked here was different.
> 
> OK
> 
> >>>>> +	rev_reg = readl(cqspi->iobase + CQSPI_REG_MODULEID);
> >>>>> +	dev_info(dev, "CQSPI Module id %x\n", rev_reg);
> >>>>> +
> >>>>> +	switch (rev_reg & CQSPI_REG_MODULEID_CONF_ID_MASK) {
> >>>>> +	case CQSPI_REG_MODULEID_CONF_ID_OCTAL_PHY:
> >>>>> +	case CQSPI_REG_MODULEID_CONF_ID_OCTAL:
> >>>>> +		mode = SPI_NOR_OCTAL;
> >>>>> +		break;
> >>>>> +	case CQSPI_REG_MODULEID_CONF_ID_QUAD:
> >>>>> +	case CQSPI_REG_MODULEID_CONF_ID_QUAD_PHY:
> >>>>
> >>>> Does this work on all revisions of CQSPI ?
> >>>>
> >>>
> >>> After having a more thorough look at specification of older IP version
> >>> (quad only) it seems, that revision register format has indeed changed.
> >>> This will be fixed in the next version of the patch.
> >>
> >> Can the quad-spi controller be configured only as dual or single ?
> >> What about the octal one ? These cases should probably be handled
> >> somehow too, right ?
> >>
> >
> > Quad-SPI controller can always support single, dual and quad. There was
> > no option to configure max mode. Octal-SPI controller can be configured
> > to support either octal or quad mode. No controller could be configured
> > (during hardware compilation/synthesis) to support only single/dual
> > SPI mode. To put it shortly: single, dual and quad is always supported.
> 
> So basically the whole check you need to perform here is
> 
> mode = quad;
> if (controller->flags & CAN_DO_OCTAL) {
>  if (readl(ID_REGISTER) & IS_CONFIGURED_AS_OCTAL)
>    mode = octal;
> }
> 

Yes. Something similar was already written and tested, and will be sent
in the next version of the patch instead.

> --
> Best regards,
> Marek Vasut


More information about the linux-mtd mailing list