]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 7 Aug 2008 08:55:03 +0000 (09:55 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 7 Aug 2008 08:55:03 +0000 (09:55 +0100)
1  2 
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-usb-a9260.c
arch/arm/mach-at91/board-usb-a9263.c
drivers/i2c/busses/i2c-s3c2410.c
drivers/spi/spi_s3c24xx.c

index 83a4494adc9e9f2af12b5db7601305b697ce1133,1f4725972edce70a2f988a58c34c5f1ccd37e776..fd21d4240e8e726d1297a49a9f630806e398124a
@@@ -33,7 -33,7 +33,7 @@@
  
  #include <video/atmel_lcdc.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -188,7 -188,7 +188,7 @@@ static struct atmel_nand_data __initdat
  //    .rdy_pin        = ... not connected
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index cb3e48cd1d5bc06d11b130ace7d41d0d8f3d344f,33b1ccdb516d4fd101c086a49ed7232823ae9505..5393b8079bd7cdc0c45af804812b1563a50f2848
@@@ -30,7 -30,7 +30,7 @@@
  #include <linux/input.h>
  #include <linux/clk.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -147,7 -147,7 +147,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index 61eab0deb3530ebf294e00540f3897aab51959a0,3cd5f8d0e2e2789d0c1ef2984e8d89aeb02d5673..fe8a8ac89d6427af244a64cedaeca54fb46e93ff
@@@ -27,7 -27,7 +27,7 @@@
  #include <linux/platform_device.h>
  #include <linux/spi/spi.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -148,7 -148,7 +148,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index de5b072dad3afa8c9ca4e3d7ea828c0668907054,daf93a5880689b0ce03f214ca0e5401e9de4884c..6f3b377dc37896884d5c3ad40458aff40ed05ccd
@@@ -28,7 -28,7 +28,7 @@@
  #include <linux/spi/at73c213.h>
  #include <linux/clk.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -185,7 -185,7 +185,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index 9a67434a12649438f6658bf378de18ed95fc7803,12bf527f93be286c828d15de8f46dac3cabf4eb4..9d3c65e79c36bc657e7b7d7cf2041e1d3783a353
@@@ -35,7 -35,7 +35,7 @@@
  
  #include <video/atmel_lcdc.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -190,7 -190,7 +190,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC15,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index cc925eca1116f53b60d3fa811426a423a43901ff,63121197f8c92573ceca028f5bfd9f1aa0464e67..334b159285c3e3c8500cb9f37a126e5603f8a40f
@@@ -32,7 -32,7 +32,7 @@@
  
  #include <video/atmel_lcdc.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -194,7 -194,7 +194,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PA22,
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index 688295f104cef76d4701c966e2eaa19819c391b2,e0c07952cc34d5ae13f214eb96db30150a3ef812..f0975bba6d513c2d359e30ffc779814e03189357
@@@ -26,7 -26,7 +26,7 @@@
  #include <linux/spi/at73c213.h>
  #include <linux/clk.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -149,7 -149,7 +149,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index aed31f86360026a332d9c91521fd81495ee337dc,2f4ecac150d9c2b185444be697c4a46c1c11cbd0..4048e47c5190ba7254144532a8b6c9b2755db54b
@@@ -30,7 -30,7 +30,7 @@@
  #include <linux/input.h>
  #include <linux/clk.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -121,7 -121,7 +121,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PC13,
        .enable_pin     = AT91_PIN_PC14,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index e37343aedf1b9604c37245732585d86632da21ed,0e9649d3eda19af87ff3a1c2b3e04b758e57e271..a2b94947f5754a0a0d98c9ca530888ffc8e6b13c
@@@ -29,7 -29,7 +29,7 @@@
  #include <linux/gpio_keys.h>
  #include <linux/input.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/irq.h>
@@@ -134,7 -134,7 +134,7 @@@ static struct atmel_nand_data __initdat
        .rdy_pin        = AT91_PIN_PA22,
        .enable_pin     = AT91_PIN_PD15,
        .partition_info = nand_partitions,
- #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
+ #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
        .bus_width_16   = 1,
  #else
        .bus_width_16   = 0,
index 598b9cbd3a05265c20876bd6bc22db4e64d5939a,4864723c74257b6e63e2d25d6c4d3ae8676f1675..b216bfbea78c1b789a2561e52ff20598d72a1801
@@@ -33,8 -33,9 +33,9 @@@
  #include <linux/err.h>
  #include <linux/platform_device.h>
  #include <linux/clk.h>
+ #include <linux/cpufreq.h>
  
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  #include <asm/irq.h>
  #include <asm/io.h>
  
@@@ -64,6 -65,7 +65,7 @@@ struct s3c24xx_i2c 
        unsigned int            tx_setup;
  
        enum s3c24xx_i2c_state  state;
+       unsigned long           clkrate;
  
        void __iomem            *regs;
        struct clk              *clk;
        struct resource         *irq;
        struct resource         *ioarea;
        struct i2c_adapter      adap;
+ #ifdef CONFIG_CPU_FREQ
+       struct notifier_block   freq_transition;
+ #endif
  };
  
  /* default platform data to use if not supplied in the platform_device
@@@ -501,6 -507,9 +507,9 @@@ static int s3c24xx_i2c_doxfer(struct s3
        unsigned long timeout;
        int ret;
  
+       if (!readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN)
+               return -EIO;
        ret = s3c24xx_i2c_set_master(i2c);
        if (ret != 0) {
                dev_err(i2c->dev, "cannot get bus (error %d)\n", ret);
@@@ -636,27 -645,28 +645,28 @@@ static inline int freq_acceptable(unsig
        return (diff >= -2 && diff <= 2);
  }
  
- /* s3c24xx_i2c_getdivisor
+ /* s3c24xx_i2c_clockrate
   *
   * work out a divisor for the user requested frequency setting,
   * either by the requested frequency, or scanning the acceptable
   * range of frequencies until something is found
  */
  
- static int s3c24xx_i2c_getdivisor(struct s3c24xx_i2c *i2c,
-                                 struct s3c2410_platform_i2c *pdata,
-                                 unsigned long *iicon,
-                                 unsigned int *got)
+ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
  {
+       struct s3c2410_platform_i2c *pdata;
        unsigned long clkin = clk_get_rate(i2c->clk);
-       
        unsigned int divs, div1;
+       u32 iiccon;
        int freq;
        int start, end;
  
+       i2c->clkrate = clkin;
+       pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
        clkin /= 1000;          /* clkin now in KHz */
       
-       dev_dbg(i2c->dev,  "pdata %p, freq %lu %lu..%lu\n",
+       dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n",
                 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq);
  
        if (pdata->bus_freq != 0) {
  
   found:
        *got = freq;
-       *iicon |= (divs-1);
-       *iicon |= (div1 == 512) ? S3C2410_IICCON_TXDIV_512 : 0;
+       iiccon = readl(i2c->regs + S3C2410_IICCON);
+       iiccon &= ~(S3C2410_IICCON_SCALEMASK | S3C2410_IICCON_TXDIV_512);
+       iiccon |= (divs-1);
+       if (div1 == 512)
+               iiccon |= S3C2410_IICCON_TXDIV_512;
+       writel(iiccon, i2c->regs + S3C2410_IICCON);
+       return 0;
+ }
+ #ifdef CONFIG_CPU_FREQ
+ #define freq_to_i2c(_n) container_of(_n, struct s3c24xx_i2c, freq_transition)
+ static int s3c24xx_i2c_cpufreq_transition(struct notifier_block *nb,
+                                         unsigned long val, void *data)
+ {
+       struct s3c24xx_i2c *i2c = freq_to_i2c(nb);
+       unsigned long flags;
+       unsigned int got;
+       int delta_f;
+       int ret;
+       delta_f = clk_get_rate(i2c->clk) - i2c->clkrate;
+       /* if we're post-change and the input clock has slowed down
+        * or at pre-change and the clock is about to speed up, then
+        * adjust our clock rate. <0 is slow, >0 speedup.
+        */
+       if ((val == CPUFREQ_POSTCHANGE && delta_f < 0) ||
+           (val == CPUFREQ_PRECHANGE && delta_f > 0)) {
+               spin_lock_irqsave(&i2c->lock, flags);
+               ret = s3c24xx_i2c_clockrate(i2c, &got);
+               spin_unlock_irqrestore(&i2c->lock, flags);
+               if (ret < 0)
+                       dev_err(i2c->dev, "cannot find frequency\n");
+               else
+                       dev_info(i2c->dev, "setting freq %d\n", got);
+       }
+       return 0;
+ }
+ static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
+ {
+       i2c->freq_transition.notifier_call = s3c24xx_i2c_cpufreq_transition;
+       return cpufreq_register_notifier(&i2c->freq_transition,
+                                        CPUFREQ_TRANSITION_NOTIFIER);
+ }
+ static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
+ {
+       cpufreq_unregister_notifier(&i2c->freq_transition,
+                                   CPUFREQ_TRANSITION_NOTIFIER);
+ }
+ #else
+ static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
+ {
        return 0;
  }
  
+ static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
+ {
+ }
+ #endif
  /* s3c24xx_i2c_init
   *
   * initialise the controller, set the IO lines and frequency 
@@@ -719,9 -797,12 +797,12 @@@ static int s3c24xx_i2c_init(struct s3c2
  
        dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr);
  
+       writel(iicon, i2c->regs + S3C2410_IICCON);
        /* we need to work out the divisors for the clock... */
  
-       if (s3c24xx_i2c_getdivisor(i2c, pdata, &iicon, &freq) != 0) {
+       if (s3c24xx_i2c_clockrate(i2c, &freq) != 0) {
+               writel(0, i2c->regs + S3C2410_IICCON);
                dev_err(i2c->dev, "cannot meet bus frequency required\n");
                return -EINVAL;
        }
  
        dev_info(i2c->dev, "bus frequency set to %d KHz\n", freq);
        dev_dbg(i2c->dev, "S3C2410_IICCON=0x%02lx\n", iicon);
-       
-       writel(iicon, i2c->regs + S3C2410_IICCON);
  
        /* check for s3c2440 i2c controller  */
  
  static int s3c24xx_i2c_probe(struct platform_device *pdev)
  {
        struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
+       struct s3c2410_platform_i2c *pdata;
        struct resource *res;
        int ret;
  
+       pdata = s3c24xx_i2c_get_platformdata(&pdev->dev);
        /* find the clock and enable it */
  
        i2c->dev = &pdev->dev;
        dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
                (unsigned long)res->start);
  
-       ret = i2c_add_adapter(&i2c->adap);
+       ret = s3c24xx_i2c_register_cpufreq(i2c);
        if (ret < 0) {
-               dev_err(&pdev->dev, "failed to add bus to i2c core\n");
+               dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
                goto err_irq;
        }
  
+       /* Note, previous versions of the driver used i2c_add_adapter()
+        * to add the bus at any number. We now pass the bus number via
+        * the platform data, so if unset it will now default to always
+        * being bus 0.
+        */
+       i2c->adap.nr = pdata->bus_num;
+       ret = i2c_add_numbered_adapter(&i2c->adap);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "failed to add bus to i2c core\n");
+               goto err_cpufreq;
+       }
        platform_set_drvdata(pdev, i2c);
  
        dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
        return 0;
  
+  err_cpufreq:
+       s3c24xx_i2c_deregister_cpufreq(i2c);
   err_irq:
        free_irq(i2c->irq->start, i2c);
  
@@@ -870,6 -969,8 +969,8 @@@ static int s3c24xx_i2c_remove(struct pl
  {
        struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
  
+       s3c24xx_i2c_deregister_cpufreq(i2c);
        i2c_del_adapter(&i2c->adap);
        free_irq(i2c->irq->start, i2c);
  
index ec282aa92aaa89150ee70a0a50bc437b2a7a3ef9,21661c7959c87cab171323d8dc1821046ee77604..89da39f02d6897789aed93839bb221744fa107f3
@@@ -25,7 -25,7 +25,7 @@@
  
  #include <asm/io.h>
  #include <asm/dma.h>
 -#include <asm/hardware.h>
 +#include <asm/arch/hardware.h>
  
  #include <asm/arch/regs-gpio.h>
  #include <asm/plat-s3c24xx/regs-spi.h>
@@@ -236,6 -236,19 +236,19 @@@ static irqreturn_t s3c24xx_spi_irq(int 
        return IRQ_HANDLED;
  }
  
+ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
+ {
+       /* for the moment, permanently enable the clock */
+       clk_enable(hw->clk);
+       /* program defaults into the registers */
+       writeb(0xff, hw->regs + S3C2410_SPPRE);
+       writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
+       writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
+ }
  static int __init s3c24xx_spi_probe(struct platform_device *pdev)
  {
        struct s3c2410_spi_info *pdata;
        /* setup the master state. */
  
        master->num_chipselect = hw->pdata->num_cs;
+       master->bus_num = pdata->bus_num;
  
        /* setup the state for the bitbang driver */
  
                goto err_no_clk;
        }
  
-       /* for the moment, permanently enable the clock */
-       clk_enable(hw->clk);
-       /* program defaults into the registers */
-       writeb(0xff, hw->regs + S3C2410_SPPRE);
-       writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
-       writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
+       s3c24xx_spi_initialsetup(hw);
  
        /* setup any gpio we can */
  
@@@ -414,7 -420,7 +420,7 @@@ static int s3c24xx_spi_resume(struct pl
  {
        struct s3c24xx_spi *hw = platform_get_drvdata(pdev);
  
-       clk_enable(hw->clk);
+       s3c24xx_spi_initialsetup(hw);
        return 0;
  }