[U-Boot] [PATCH v4] spi: Add SPI driver for MT76xx SoCs

Stefan Roese sr at denx.de
Thu Aug 16 08:22:11 UTC 2018


Hi Piotr,

On 16.08.2018 09:24, Piotr Dymacz wrote:
> Please, see my comment regarding MT7620 vs. MT76x8 below.
> 
> On 15.08.2018 17:19, Stefan Roese wrote:
>> This patch adds the SPI driver for the MediaTek MT7688 SoC (and
>> derivates). Its been tested on the LinkIt Smart 7688 and the Gardena
>> Smart Gateway with and SPI NOR on CS0 and on the Gardena Smart
>> Gateway additionally with an SPI NAND on CS1.
>>
>> Note that the SPI controller only supports a max transfer size of 32
>> bytes. This driver implementes a workaround to enable bigger xfer
>> sizes to speed up the transfer especially for the SPI NAND support.
>>
>> Signed-off-by: Stefan Roese <sr at denx.de>
>> Cc: Jagan Teki <jagan at openedev.com>
>> Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
>> Reviewed-by: Jagan Teki <jagan at openedev.com>
>> ---
>> v4:
>> - Rename functions and macros from mt7621 to mt76xx to better
>>    reflect the SoC usage and match the driver name
>>
>> v3:
>> - Drop IO wrappers completely as suggested by Daniel
>> - Read "clock-frequency" DT property instead of using
>>    CONFIG_SYS_MIPS_TIMER_FREQ
>>
>> v2:
>> - Add some macros instead of hardcoded numbers
>> - Move compatible DT struct down in the file
>>
>>   drivers/spi/Kconfig      |   8 +
>>   drivers/spi/Makefile     |   1 +
>>   drivers/spi/mt76xx_spi.c | 312 +++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 321 insertions(+)
>>   create mode 100644 drivers/spi/mt76xx_spi.c
>>
>> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
>> index 9fbd26740d..6c4e50d3e9 100644
>> --- a/drivers/spi/Kconfig
>> +++ b/drivers/spi/Kconfig
>> @@ -116,6 +116,14 @@ config ICH_SPI
>>         access the SPI NOR flash on platforms embedding this Intel
>>         ICH IP core.
>> +config MT76XX_SPI
>> +    bool "MediaTek MT76XX SPI driver"
>> +    depends on ARCH_MT7620
> 
> MT76xx name will be confusing here. This driver doesn't support MT7620 
> which is an old SOC, (apparently) based on Ralink RT5350 series [0]. 
> There is a separate SPI driver "spi-rt2880" in OpenWrt tree [1] which 
> covers old Ralink RTxxxx and MediaTek MT7620 MIPS based WiSOCs.
> 
> The "spi-mt7621" driver supports only MT7621 and MT76{2,8}8 series (they 
> include the same SPI controller block which is different that the one in 
> RTxxxx/MT7620).

Thanks for this comment and explanation. Frankly, I'm not that
experienced with these Ralink / MediaTek SoCs in all their flavors.
I'll move back to using the old mt7621 name as filename and function
names then in v5. That's the compatible property as well and looks
like the correct naming with your comment.

> I didn't check deeply your "mips: Add basic MediaTek MT7620/88 support" 
> series but assumption that MT7620 and MT76{2,8}8 families are similar 
> seems to be just too optimistic - for example, the MT76XX_RGCTRL_BASE 
> (RALINK_RGCTRL_BASE) register in low level initialization is used (and 
> defined) only for MT76x8 in old U-Boot sources from MediaTek SDK (see: 
> [2] and [3]). I'm not that familiar with early setup of MediaTek/Ralink 
> WiSOCs but based on the already existing code I don't think that MT7620 
> support should be simply combined with MT76{2,8}8.

Yes, I agree, that there might be problems supporting all these
SoC flavors here. We definitely should use the DT to differentiate
between multiple SoCs. Please see this "basic" support as a starting
point, which very likely needs some additions / tuning to support
other MT76xx SoCs. I'm hoping that other users / developers will
join in at some point and will start submitting support for other
SoCs to mainline U-Boot. Especially since the old MediaTek U-Boot is
in very bad shape.

Thanks,
Stefan


More information about the U-Boot mailing list