# BSP内核移植FBTFT 首先吧fbtft从主线目录拷贝到bsp目录 修改Makefile和Kconfig ~~~ obj-$(CONFIG_FB_TFT) += fbtft/ source "drivers/staging/fbtft/Kconfig" ~~~ 编译出错: ~~~ drivers/staging/fbtft/fbtft-bus.c: In function 'fbtft_write_vmem16_bus8': drivers/staging/fbtft/fbtft-bus.c:130:28: error: 'struct fb_info' has no member named 'screen_buffer' ~~~ 修改include/linux/fb.h:L839 ~~~ union { char __iomem *screen_base; /* Virtual address */ char *screen_buffer; }; ~~~ 出错: ~~~ drivers/staging/fbtft/fbtft-core.c: In function 'fbtft_request_gpios': drivers/staging/fbtft/fbtft-core.c:148:4: error: implicit declaration of function 'devm_gpio_request_one' [-Werror=implicit-function-declaration] CC drivers/video/sunxi/disp2/disp/de/disp_manager.o drivers/staging/fbtft/fbtft-core.c: In function 'fbtft_framebuffer_alloc': CC drivers/video/sunxi/disp2/disp/de/disp_private.o drivers/staging/fbtft/fbtft-core.c:753:3: error: implicit declaration of function 'devm_kcalloc' [-Werror=implicit-function-declaration] drivers/staging/fbtft/fbtft-core.c:753:16: warning: assignment makes pointer from integer without a cast [enabled by default] drivers/staging/fbtft/fbtft-core.c: In function 'fbtft_probe_common': drivers/staging/fbtft/fbtft-core.c:1403:23: error: 'struct spi_master' has no member named 'bits_per_word_mask' drivers/staging/fbtft/fbtft-core.c:1403:3: error: implicit declaration of function 'SPI_BPW_MASK' [-Werror=implicit-function-declaration] CC drivers/video/sunxi/disp2/disp/de/disp_smart_backlight.o ~~~ 新内核使用了devm前缀的函数,说明参考这里: http://blog.csdn.net/cc289123557/article/details/52137803 改回旧版本接口 ~~~ int devm_gpio_request_one(struct device *dev, unsigned gpio, unsigned long flags, const char *label) int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) ~~~ 出错: spi结构体,注释掉相应部分。(9bit没用到) ~~~ drivers/staging/fbtft/fbtft-core.c: In function 'fbtft_probe_common': drivers/staging/fbtft/fbtft-core.c:1403:23: error: 'struct spi_master' has no member named 'bits_per_word_mask' drivers/staging/fbtft/fbtft-core.c:1403:3: error: implicit declaration of function 'SPI_BPW_MASK' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors scripts/Makefile.build:307: recipe for target 'drivers/staging/fbtft/fbtft-core.o' failed make[3]: *** [drivers/staging/fbtft/fbtft-core.o] Error 1 make[3]: *** Waiting for unfinished jobs.... CC drivers/video/sunxi/disp2/disp/dev_disp.o drivers/staging/fbtft/flexfb.c: In function 'flexfb_probe_common': drivers/staging/fbtft/flexfb.c:688:24: error: 'struct spi_master' has no member named 'bits_per_word_mask' drivers/staging/fbtft/flexfb.c:689:8: error: implicit declaration of function 'SPI_BPW_MASK' [-Werror=implicit-function-declaration] CC drivers/video/sunxi/disp2/disp/dev_fb.o CC drivers/video/sunxi/disp2/disp/dev_disp_debugfs.o cc1: some warnings being treated as errors ~~~ 编译通过。 加载方式: ~~~ ili9341@0 { compatible = "ilitek,ili9341"; reg = <0>; spi-max-frequency = <50000000>; rotate = <270>; bgr; fps = <30>; buswidth = <8>; reset-gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; dc-gpios = <&pio 1 5 GPIO_ACTIVE_LOW>; debug = <0>; }; ~~~