Re[2]: [PATCH 1/6] mc13xxx: Define maximum SPI clock frequency global to driver

Alexander Shiyan shc_work at mail.ru
Fri Jul 20 04:05:21 EDT 2012


Hello.

Thu, 19 Jul 2012 19:55:12 +0200 от Sascha Hauer <s.hauer at pengutronix.de>:
> On Thu, Jul 19, 2012 at 07:30:12PM +0400, Alexander Shiyan wrote:
>  > This patch provide setup for SPI clk frequency global to driver.
>  > For MC13783 maximum clock frequency is 20 MHz,
>  > for MC13892 maximum clock frequency is 26 MHz,
>  > so we define 20 MHz as a maximum SPI clk.
>  > 
>  > Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
>  > ---
>  > arch/arm/boards/ccxmx51/ccxmx51.c | 1 -
>  > arch/arm/boards/freescale-mx51-pdk/board.c | 1 -
>  > arch/arm/boards/pcm038/pcm038.c | 1 -
>  > drivers/mfd/mc13xxx.c | 1 +
>  > 4 files changed, 1 insertions(+), 3 deletions(-)
>  > 
>  > diff --git a/arch/arm/boards/ccxmx51/ccxmx51.c b/arch/arm/boards/ccxmx51/ccxmx51.c
>  > index f494174..f309e0c 100644
>  > --- a/arch/arm/boards/ccxmx51/ccxmx51.c
>  > +++ b/arch/arm/boards/ccxmx51/ccxmx51.c
>  > @@ -191,7 +191,6 @@ static struct spi_imx_master ecspi_0_data = {
>  > static const struct spi_board_info ccxmx51_spi_board_info[] = {
>  > {
>  > .name = "mc13xxx-spi",
>  > - .max_speed_hz = 6000000,
>  > .bus_num = 0,
>  > .chip_select = 0,
>  > },
>  > diff --git a/arch/arm/boards/freescale-mx51-pdk/board.c b/arch/arm/boards/freescale-mx51-pdk/board.c
>  > index 3a568d0..7c2c8fe 100644
>  > --- a/arch/arm/boards/freescale-mx51-pdk/board.c
>  > +++ b/arch/arm/boards/freescale-mx51-pdk/board.c
>  > @@ -117,7 +117,6 @@ static struct spi_imx_master spi_0_data = {
>  > static const struct spi_board_info mx51_babbage_spi_board_info[] = {
>  > {
>  > .name = "mc13xxx-spi",
>  > - .max_speed_hz = 300000,
>  > .bus_num = 0,
>  > .chip_select = 0,
>  > },
>  > diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
>  > index badc978..fa82b02 100644
>  > --- a/arch/arm/boards/pcm038/pcm038.c
>  > +++ b/arch/arm/boards/pcm038/pcm038.c
>  > @@ -59,7 +59,6 @@ static struct spi_imx_master pcm038_spi_0_data = {
>  > static struct spi_board_info pcm038_spi_board_info[] = {
>  > {
>  > .name = "mc13xxx-spi",
>  > - .max_speed_hz = 3000000,
>  > .bus_num = 0,
>  > .chip_select = 0,
>  > }
>  > diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
>  > index 2934e9d..8bb0d00 100644
>  > --- a/drivers/mfd/mc13xxx.c
>  > +++ b/drivers/mfd/mc13xxx.c
>  > @@ -297,6 +297,7 @@ static int mc_probe(struct device_d *dev, enum mc13xxx_mode mode)
>  > mc_dev->spi = dev->type_data;
>  > mc_dev->spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
>  > mc_dev->spi->bits_per_word = 32;
>  > + mc_dev->spi->max_speed_hz = 20000000;
> 
>  The values indeed look quite arbitrary, but it may be that a hardware
>  design does not support such high frequencies. Maybe better
> 
>  if (!mc_dev->spi->max_speed_hz)
>  mc_dev->spi->max_speed_hz = 20000000
> 
>  ?
On my opinion, tests for supported speed, is work for SPI-driver, not for device driver.
Is not it?


More information about the barebox mailing list