Commit 75497d96 authored by Ben Dooks's avatar Ben Dooks

ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info()

The s3c64xx_spi_set_info() sets one of two platform data structures depending
on which controller is being specified. Change to taking a pointer to the
relevant platform data structure and then having one set of code to place
the data into the area being pointed to.

Cc: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent bd548e5e
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <mach/gpio.h> #include <mach/gpio.h>
#include <plat/spi-clocks.h> #include <plat/spi-clocks.h>
#include <plat/s3c64xx-spi.h> #include <plat/s3c64xx-spi.h>
#include <plat/gpio-bank-c.h> #include <plat/gpio-bank-c.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
...@@ -154,6 +155,8 @@ EXPORT_SYMBOL(s3c64xx_device_spi1); ...@@ -154,6 +155,8 @@ EXPORT_SYMBOL(s3c64xx_device_spi1);
void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
{ {
struct s3c64xx_spi_info *pd;
/* Reject invalid configuration */ /* Reject invalid configuration */
if (!num_cs || src_clk_nr < 0 if (!num_cs || src_clk_nr < 0
|| src_clk_nr > S3C64XX_SPI_SRCCLK_48M) { || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) {
...@@ -163,18 +166,18 @@ void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) ...@@ -163,18 +166,18 @@ void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
switch (cntrlr) { switch (cntrlr) {
case 0: case 0:
s3c64xx_spi0_pdata.num_cs = num_cs; pd = &s3c64xx_spi0_pdata;
s3c64xx_spi0_pdata.src_clk_nr = src_clk_nr;
s3c64xx_spi0_pdata.src_clk_name = spi_src_clks[src_clk_nr];
break; break;
case 1: case 1:
s3c64xx_spi1_pdata.num_cs = num_cs; pd = &s3c64xx_spi1_pdata;
s3c64xx_spi1_pdata.src_clk_nr = src_clk_nr;
s3c64xx_spi1_pdata.src_clk_name = spi_src_clks[src_clk_nr];
break; break;
default: default:
printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
__func__, cntrlr); __func__, cntrlr);
return; return;
} }
pd->num_cs = num_cs;
pd->src_clk_nr = src_clk_nr;
pd->src_clk_name = spi_src_clks[src_clk_nr];
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment