change raho lcd color & spi cs
authorroot <root@dxj.(none)>
Mon, 26 Jul 2010 09:57:27 +0000 (17:57 +0800)
committerroot <root@dxj.(none)>
Mon, 26 Jul 2010 10:09:21 +0000 (18:09 +0800)
arch/arm/mach-rk2818/board-raho.c
drivers/spi/rk2818_spim.c
drivers/spi/rk2818_spim.h
drivers/video/display/screen/lcd_hx8357.c

index 97a5c18f4d537812b9917cdc355e6d4975075315..94f24fb56a133a538d07d7645b589cf1f3446626 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "devices.h"
 
+#include "../../../drivers/spi/rk2818_spim.h"
 
 /* --------------------------------------------------------------------
  *  ÉùÃ÷ÁËrk2818_gpioBankÊý×飬²¢¶¨ÒåÁËGPIO¼Ä´æÆ÷×éIDºÍ¼Ä´æÆ÷»ùµØÖ·¡£
@@ -388,6 +389,25 @@ static struct i2c_board_info __initdata board_i2c3_devices[] = {
        
 };     
 
+static void spi_xpt2046_cs_control(u32 command)
+{
+       if(command == 3)        
+           {
+           //printk("spi_xpt2046_cs_control cs \n");
+           gpio_direction_output(RK2818_PIN_PF5, GPIO_LOW);
+           }
+       if(command == 0)
+           {
+           //printk("spi_xpt2046_cs_control decs \n");
+           gpio_direction_output(RK2818_PIN_PF5, GPIO_HIGH);
+           }
+}
+
+struct rk2818_spi_chip spi_xpt2046_info = {
+       .cs_control = spi_xpt2046_cs_control,
+};
+
+
 /*****************************************************************************************
  * SPI devices
  *author: lhh
@@ -414,10 +434,11 @@ static struct spi_board_info board_spi_devices[] = {
 #if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) || defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)
        {
                .modalias       = "xpt2046_ts",
-               .chip_select    = 0,
+               .chip_select    = 2,
                .max_speed_hz   = 125 * 1000 * 26,/* (max sample rate @ 3V) * (cmd + data + overhead) */
                .bus_num        = 0,
-               .irq            = RK2818_PIN_PE1,
+               .controller_data = &spi_xpt2046_info,
+               .irq = RK2818_PIN_PE1,
        },
 #endif
 
@@ -557,6 +578,13 @@ static void __init machine_rk2818_board_init(void)
        rk2818_mux_api_set(GPIOB4_SPI0CS0_MMC0D4_NAME,IOMUXA_GPIO0_B4); //IOMUXA_SPI0_CSN0);//use for gpio SPI CS0
        rk2818_mux_api_set(GPIOB0_SPI0CSN1_MMC1PCA_NAME,IOMUXA_GPIO0_B0); //IOMUXA_SPI0_CSN1);//use for gpio SPI CS1
        rk2818_mux_api_set(GPIOB_SPI0_MMC0_NAME,IOMUXA_SPI0);//use for SPI CLK SDI SDO
+
+       rk2818_mux_api_set(GPIOF5_APWM3_DPWM3_NAME,IOMUXB_GPIO1_B5);
+       if(0 != gpio_request(RK2818_PIN_PF5, NULL))
+    {
+        gpio_free(RK2818_PIN_PF5);
+        printk(">>>>>> RK2818_PIN_PF5 gpio_request err \n "); 
+    } 
 }
 
 static void __init machine_rk2818_mapio(void)
index 4372e205f8d3c38239140251bf57e90c2cffd855..5013c30aa603f8b7b2ea432d65954fae6a3de872 100644 (file)
@@ -428,6 +428,17 @@ static void dma_transfer(struct rk2818_spi *dws, struct spi_transfer *xfer) //in
        
 }
 
+static void spi_chip_sel(struct rk2818_spi *dws, u16 cs)
+{
+    if(cs >= dws->master->num_chipselect)
+               return;
+
+       if (dws->cs_control){
+           dws->cs_control(cs+1);
+       }
+       //rk2818_writel(dws, SPIM_SER, 1 << cs);
+}
+
 static void pump_transfers(unsigned long data)
 {
        struct rk2818_spi *dws = (struct rk2818_spi *)data;
@@ -644,7 +655,8 @@ static void pump_messages(struct work_struct *work)
                                                struct spi_transfer,
                                                transfer_list);
        dws->cur_chip = spi_get_ctldata(dws->cur_msg->spi);
-
+    dws->prev_chip = NULL; //ÿ¸öpump messageʱǿÖƸüÐÂcs dxj
+    
        /* Mark as busy and launch transfers */
        tasklet_schedule(&dws->pump_transfers);
 
@@ -953,7 +965,11 @@ static int __init rk2818_spim_probe(struct platform_device *pdev)
        }
        master->mode_bits = SPI_CPOL | SPI_CPHA;
        master->bus_num = pdev->id;
-       master->num_chipselect = 2;
+#if defined(CONFIG_MACH_RAHO)  
+       master->num_chipselect = 3; //raho ´ó°åÐèÒªÖ§³Ö3¸öƬѡ dxj
+#else
+    master->num_chipselect = 2; 
+#endif
        master->cleanup = rk2818_spi_cleanup;
        master->setup = rk2818_spi_setup;
        master->transfer = rk2818_spi_transfer;
index e486c4b689277d4a2517477b36e42e95790b00b5..efc6f4c990676f738c72a1e359ea3df9b00ac7a8 100644 (file)
@@ -178,20 +178,6 @@ static inline void spi_set_clk(struct rk2818_spi *dws, u16 div)
        rk2818_writel(dws, SPIM_BAUDR, div);
 }
 
-static inline void spi_chip_sel(struct rk2818_spi *dws, u16 cs)
-{
-       if (cs > 1)
-               return;
-
-       if (dws->cs_control){
-               if(cs == 1)
-                       dws->cs_control(2);     
-               else
-                       dws->cs_control(1);
-       }
-       rk2818_writel(dws, SPIM_SER, 1 << cs);
-}
-
 /* Disable IRQ bits */
 static inline void spi_mask_intr(struct rk2818_spi *dws, u32 mask)
 {
index 5648f88e36e718ed9bf5dd2970ab9d579cc4b825..531119d7ea4b60f30f69a4ecee98567f2712a055 100644 (file)
@@ -24,7 +24,7 @@
 
 /* Other */
 #define DCLK_POL               0 
-#define SWAP_RB                        1
+#define SWAP_RB                        0
 
 int init(void);
 int standby(u8 enable);