From: David Brownell <david-b@pacbell.net>
To: Bryan Wu <bryan.wu@analog.com>
Cc: spi-devel-general@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Sonic Zhang <sonic.zhang@analog.com>
Subject: Re: [PATCH 07/14] Blackfin SPI driver: Add SPI master controller platform device 1
Date: Tue, 30 Oct 2007 12:08:13 -0700 [thread overview]
Message-ID: <200710301208.13367.david-b@pacbell.net> (raw)
In-Reply-To: <1193735885-8202-8-git-send-email-bryan.wu@analog.com>
On Tuesday 30 October 2007, Bryan Wu wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
>
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
The patch comments in this series leave a bit to be desired,
especially patches from Sonic. (Several are like this one:
just a $SUBJECT, no description.) I've improved them in the
versions I'll be sending on ...
It's worth noting that in this case the $SUBJECT doesn't
relate *at all* to what this patch actually does! Namely,
it uses the portmux mechanism to add support for two more
SPI buses ... it doesn't add a platform device.
- Dave
> ---
> drivers/spi/spi_bfin5xx.c | 52 ++++++++++++++++++++++++++------------------
> 1 files changed, 31 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
> index 3f3630c..3bd8359 100644
> --- a/drivers/spi/spi_bfin5xx.c
> +++ b/drivers/spi/spi_bfin5xx.c
> @@ -209,17 +209,26 @@ static void cs_deactive(struct chip_data *chip)
> write_FLAG(flag);
> }
>
> -#define MAX_SPI0_SSEL 7
> +#define MAX_SPI_SSEL 7
>
> /* stop controller and re-config current chip*/
> static int restore_state(struct driver_data *drv_data)
> {
> struct chip_data *chip = drv_data->cur_chip;
> int ret = 0;
> - u16 ssel[MAX_SPI0_SSEL] = {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3,
> - P_SPI0_SSEL4, P_SPI0_SSEL5,
> - P_SPI0_SSEL6, P_SPI0_SSEL7,};
> -
> + u16 ssel[3][MAX_SPI_SSEL] = {
> + {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3,
> + P_SPI0_SSEL4, P_SPI0_SSEL5,
> + P_SPI0_SSEL6, P_SPI0_SSEL7},
> +
> + {P_SPI1_SSEL1, P_SPI1_SSEL2, P_SPI1_SSEL3,
> + P_SPI1_SSEL4, P_SPI1_SSEL5,
> + P_SPI1_SSEL6, P_SPI1_SSEL7},
> +
> + {P_SPI2_SSEL1, P_SPI2_SSEL2, P_SPI2_SSEL3,
> + P_SPI2_SSEL4, P_SPI2_SSEL5,
> + P_SPI2_SSEL6, P_SPI2_SSEL7},
> + };
> /* Clear status and disable clock */
> write_STAT(BIT_STAT_CLR);
> bfin_spi_disable(drv_data);
> @@ -234,9 +243,9 @@ static int restore_state(struct driver_data *drv_data)
> int i = chip->chip_select_num;
>
> dev_dbg(&drv_data->pdev->dev, "chip select number is %d\n", i);
> -
> - if ((i > 0) && (i <= MAX_SPI0_SSEL))
> - ret = peripheral_request(ssel[i-1], DRV_NAME);
> + if ((i > 0) && (i <= MAX_SPI_SSEL))
> + ret = peripheral_request(
> + ssel[drv_data->master->bus_num][i-1], DRV_NAME);
>
> chip->chip_select_requested = 1;
> }
> @@ -329,7 +338,6 @@ static void u8_reader(struct driver_data *drv_data)
> write_TDBR(0xFFFF);
>
> dummy_read();
> -
> while (drv_data->rx < drv_data->rx_end - 1) {
> while (!(read_STAT() & BIT_STAT_RXS))
> continue;
> @@ -640,7 +648,6 @@ static void pump_transfers(unsigned long data)
> message = drv_data->cur_msg;
> transfer = drv_data->cur_transfer;
> chip = drv_data->cur_chip;
> -
> /*
> * if msg is error or done, report it back using complete() callback
> */
> @@ -1202,17 +1209,20 @@ static inline int destroy_queue(struct driver_data *drv_data)
> return 0;
> }
>
> -static int setup_pin_mux(int action)
> +static int setup_pin_mux(int action, int bus_num)
> {
>
> - u16 pin_req[] = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0};
> + u16 pin_req[3][4] = {
> + {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
> + {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
> + {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0},
> + };
>
> if (action) {
> - if (peripheral_request_list(pin_req, DRV_NAME)) {
> + if (peripheral_request_list(pin_req[bus_num], DRV_NAME))
> return -EFAULT;
> - }
> } else {
> - peripheral_free_list(pin_req);
> + peripheral_free_list(pin_req[bus_num]);
> }
>
> return 0;
> @@ -1236,11 +1246,6 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> - if (setup_pin_mux(1)) {
> - dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
> - goto out_error;
> - }
> -
> drv_data = spi_master_get_devdata(master);
> drv_data->master = master;
> drv_data->master_info = platform_info;
> @@ -1295,6 +1300,11 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
> goto out_error_queue_alloc;
> }
>
> + if (setup_pin_mux(1, master->bus_num)) {
> + dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
> + goto out_error;
> + }
> +
> dev_info(dev, "%s, Version %s, regs_base @ 0x%08x\n",
> DRV_DESC, DRV_VERSION, spi_regs_base);
> return status;
> @@ -1337,7 +1347,7 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev)
> /* Disconnect from the SPI framework */
> spi_unregister_master(drv_data->master);
>
> - setup_pin_mux(0);
> + setup_pin_mux(0, drv_data->master->bus_num);
>
> /* Prevent double remove */
> platform_set_drvdata(pdev, NULL);
> --
> 1.5.3.4
>
next prev parent reply other threads:[~2007-10-30 19:08 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-30 9:17 [PATCH 00/14] Blackfin on-chip SPI controller driver updates and bug-fixing Bryan Wu
2007-10-30 9:17 ` [PATCH 01/14] Blackfin SPI driver: Initial supporting BF54x in SPI driver Bryan Wu
2007-10-30 9:17 ` [PATCH 02/14] Blackfin SPI driver: use new GPIO API and add error handling Bryan Wu
2007-10-30 9:17 ` [PATCH 03/14] Blackfin SPI driver: add error handing Bryan Wu
2007-10-30 9:17 ` [PATCH 04/14] Blackfin SPI driver: Blackfin SPI driver does not respect the per-transfer cs_change field Bryan Wu
2007-10-30 9:17 ` [PATCH 05/14] Blackfin SPI driver: prevent people from setting bits in ctl_reg Bryan Wu
2007-10-30 9:17 ` [PATCH 06/14] Blackfin SPI driver: update spi driver to support multi-ports Bryan Wu
2007-10-30 9:17 ` [PATCH 07/14] Blackfin SPI driver: Add SPI master controller platform device 1 Bryan Wu
2007-10-30 19:08 ` David Brownell [this message]
2007-10-31 4:18 ` Bryan Wu
2007-10-30 9:17 ` [PATCH 08/14] Blackfin SPI driver: Move GPIO config to setup and cleanup Bryan Wu
2007-10-30 9:18 ` [PATCH 09/14] Blackfin SPI driver: Fix SPI driver to work with SPI flash ST25P16 on bf548 Bryan Wu
2007-10-30 20:05 ` David Brownell
2007-10-31 6:50 ` Bryan Wu
2007-10-31 7:11 ` David Brownell
2007-10-31 7:35 ` Bryan Wu
2007-10-31 8:02 ` David Brownell
2007-10-31 8:52 ` Bryan Wu
2007-10-31 8:33 ` Mike Frysinger
2007-10-31 19:01 ` David Brownell
2007-10-31 19:16 ` Mike Frysinger
2007-10-31 20:14 ` David Brownell
2007-10-30 9:18 ` [PATCH 10/14] Blackfin SPI driver: Clean up useless wait in bfin SPI driver Bryan Wu
2007-10-30 9:18 ` [PATCH 11/14] Blackfin SPI driver: Move global SPI regs_base and dma_ch to struct driver_data Bryan Wu
2007-10-30 9:18 ` [PATCH 12/14] Blackfin SPI driver: Fix bug in u16_cs_chg_reader to read data_len-2 bytes data firstly, then read out the last 2 bytes data Bryan Wu
2007-10-30 9:18 ` [PATCH 13/14] Blackfin SPI driver: Move cs_chg_udelay to cs_deactive to fix bug when some SPI LCD driver needs delay after cs_deactive Bryan Wu
2007-10-30 20:18 ` David Brownell
2007-10-31 6:30 ` Bryan Wu
2007-10-31 19:04 ` Cameron Barfield
2007-10-30 9:18 ` [PATCH 14/14] Blackfin SPI driver: set correct baud for spi mmc and enable SPI after DMA Bryan Wu
2007-10-30 20:24 ` [PATCH 00/14] Blackfin on-chip SPI controller driver updates and bug-fixing David Brownell
2007-10-30 20:29 ` Mike Frysinger
2007-10-30 20:42 ` David Brownell
2007-10-30 20:54 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200710301208.13367.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=bryan.wu@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sonic.zhang@analog.com \
--cc=spi-devel-general@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox