linux/include/linux/platform_data/spi-s3c64xx.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2
   3/*
   4 * Copyright (C) 2009 Samsung Electronics Ltd.
   5 *      Jaswinder Singh <jassi.brar@samsung.com>
   6 */
   7
   8#ifndef __SPI_S3C64XX_H
   9#define __SPI_S3C64XX_H
  10
  11#include <linux/dmaengine.h>
  12
  13struct platform_device;
  14
  15/**
  16 * struct s3c64xx_spi_csinfo - ChipSelect description
  17 * @fb_delay: Slave specific feedback delay.
  18 *            Refer to FB_CLK_SEL register definition in SPI chapter.
  19 * @line: Custom 'identity' of the CS line.
  20 *
  21 * This is per SPI-Slave Chipselect information.
  22 * Allocate and initialize one in machine init code and make the
  23 * spi_board_info.controller_data point to it.
  24 */
  25struct s3c64xx_spi_csinfo {
  26        u8 fb_delay;
  27        unsigned line;
  28};
  29
  30/**
  31 * struct s3c64xx_spi_info - SPI Controller defining structure
  32 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
  33 * @num_cs: Number of CS this controller emulates.
  34 * @cfg_gpio: Configure pins for this SPI controller.
  35 */
  36struct s3c64xx_spi_info {
  37        int src_clk_nr;
  38        int num_cs;
  39        bool no_cs;
  40        int (*cfg_gpio)(void);
  41};
  42
  43/**
  44 * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  45 *                              initialization code.
  46 * @cfg_gpio: Pointer to gpio setup function.
  47 * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  48 * @num_cs: Number of elements in the 'cs' array.
  49 *
  50 * Call this from machine init code for each SPI Controller that
  51 * has some chips attached to it.
  52 */
  53extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  54                                                int num_cs);
  55extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  56                                                int num_cs);
  57extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  58                                                int num_cs);
  59
  60/* defined by architecture to configure gpio */
  61extern int s3c64xx_spi0_cfg_gpio(void);
  62extern int s3c64xx_spi1_cfg_gpio(void);
  63extern int s3c64xx_spi2_cfg_gpio(void);
  64
  65extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
  66extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
  67extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
  68#endif /*__SPI_S3C64XX_H */
  69