staging: sm750fb: Merge ddk750_help.* into ddk750_chip.*.
The file ddk750_help.c contained only one function declaration, so it was merged into ddk750_chip.c to simplify the driver. Also, ddk750_help.h was merged into ddk750_chip.h to keep consistency. With these changes a few global variables are removed and the function ddk750_set_mmio is rewritten, so its purpose in the code is clearer. Signed-off-by: Elise Lennion <elise.lennion@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1ffe8bdc09
commit
efe9bc08bf
|
@ -1,4 +1,4 @@
|
||||||
obj-$(CONFIG_FB_SM750) += sm750fb.o
|
obj-$(CONFIG_FB_SM750) += sm750fb.o
|
||||||
|
|
||||||
sm750fb-objs := sm750.o sm750_hw.o sm750_accel.o sm750_cursor.o ddk750_chip.o ddk750_power.o ddk750_mode.o
|
sm750fb-objs := sm750.o sm750_hw.o sm750_accel.o sm750_cursor.o ddk750_chip.o ddk750_power.o ddk750_mode.o
|
||||||
sm750fb-objs += ddk750_display.o ddk750_help.o ddk750_swi2c.o ddk750_sii164.o ddk750_dvi.o ddk750_hwi2c.o
|
sm750fb-objs += ddk750_display.o ddk750_swi2c.o ddk750_sii164.o ddk750_dvi.o ddk750_hwi2c.o
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "ddk750_chip.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_display.h"
|
#include "ddk750_display.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
#include "ddk750_help.h"
|
|
||||||
#ifdef USE_HW_I2C
|
#ifdef USE_HW_I2C
|
||||||
#include "ddk750_hwi2c.h"
|
#include "ddk750_hwi2c.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,33 +1,32 @@
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
|
|
||||||
#include "ddk750_help.h"
|
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_chip.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
|
|
||||||
#define MHz(x) ((x) * 1000000)
|
#define MHz(x) ((x) * 1000000)
|
||||||
|
|
||||||
|
static logical_chip_type_t chip;
|
||||||
|
|
||||||
logical_chip_type_t sm750_get_chip_type(void)
|
logical_chip_type_t sm750_get_chip_type(void)
|
||||||
{
|
{
|
||||||
unsigned short physicalID;
|
return chip;
|
||||||
char physicalRev;
|
}
|
||||||
logical_chip_type_t chip;
|
|
||||||
|
|
||||||
physicalID = devId750; /* either 0x718 or 0x750 */
|
void sm750_set_chip_type(unsigned short devId, char revId)
|
||||||
physicalRev = revId750;
|
{
|
||||||
|
if (devId == 0x718)
|
||||||
if (physicalID == 0x718)
|
|
||||||
chip = SM718;
|
chip = SM718;
|
||||||
else if (physicalID == 0x750) {
|
else if (devId == 0x750) {
|
||||||
chip = SM750;
|
chip = SM750;
|
||||||
/* SM750 and SM750LE are different in their revision ID only. */
|
/* SM750 and SM750LE are different in their revision ID only. */
|
||||||
if (physicalRev == SM750LE_REVISION_ID)
|
if (revId == SM750LE_REVISION_ID) {
|
||||||
chip = SM750LE;
|
chip = SM750LE;
|
||||||
|
pr_info("found sm750le\n");
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
chip = SM_UNKNOWN;
|
chip = SM_UNKNOWN;
|
||||||
|
|
||||||
return chip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int get_mxclk_freq(void)
|
static unsigned int get_mxclk_freq(void)
|
||||||
|
|
|
@ -6,6 +6,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/ioport.h>
|
||||||
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
|
/* software control endianness */
|
||||||
|
#define PEEK32(addr) readl(addr + mmio750)
|
||||||
|
#define POKE32(addr, data) writel(data, addr + mmio750)
|
||||||
|
|
||||||
|
extern void __iomem *mmio750;
|
||||||
|
|
||||||
/* This is all the chips recognized by this library */
|
/* This is all the chips recognized by this library */
|
||||||
typedef enum _logical_chip_type_t {
|
typedef enum _logical_chip_type_t {
|
||||||
|
@ -68,9 +76,9 @@ struct initchip_param {
|
||||||
};
|
};
|
||||||
|
|
||||||
logical_chip_type_t sm750_get_chip_type(void);
|
logical_chip_type_t sm750_get_chip_type(void);
|
||||||
|
void sm750_set_chip_type(unsigned short devId, char revId);
|
||||||
unsigned int calcPllValue(unsigned int request, struct pll_value *pll);
|
unsigned int calcPllValue(unsigned int request, struct pll_value *pll);
|
||||||
unsigned int formatPllReg(struct pll_value *pPLL);
|
unsigned int formatPllReg(struct pll_value *pPLL);
|
||||||
void ddk750_set_mmio(void __iomem *, unsigned short, char);
|
|
||||||
unsigned int ddk750_getVMSize(void);
|
unsigned int ddk750_getVMSize(void);
|
||||||
int ddk750_initHw(struct initchip_param *);
|
int ddk750_initHw(struct initchip_param *);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_help.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_display.h"
|
#include "ddk750_display.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
#include "ddk750_dvi.h"
|
#include "ddk750_dvi.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define USE_DVICHIP
|
#define USE_DVICHIP
|
||||||
#ifdef USE_DVICHIP
|
#ifdef USE_DVICHIP
|
||||||
#include "ddk750_help.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_dvi.h"
|
#include "ddk750_dvi.h"
|
||||||
#include "ddk750_sii164.h"
|
#include "ddk750_sii164.h"
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#include "ddk750_help.h"
|
|
||||||
|
|
||||||
void __iomem *mmio750;
|
|
||||||
char revId750;
|
|
||||||
unsigned short devId750;
|
|
||||||
|
|
||||||
/* after driver mapped io registers, use this function first */
|
|
||||||
void ddk750_set_mmio(void __iomem *addr, unsigned short devId, char revId)
|
|
||||||
{
|
|
||||||
mmio750 = addr;
|
|
||||||
devId750 = devId;
|
|
||||||
revId750 = revId;
|
|
||||||
if (revId == 0xfe)
|
|
||||||
pr_info("found sm750le\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#ifndef DDK750_HELP_H__
|
|
||||||
#define DDK750_HELP_H__
|
|
||||||
#include "ddk750_chip.h"
|
|
||||||
#ifndef USE_INTERNAL_REGISTER_ACCESS
|
|
||||||
|
|
||||||
#include <linux/ioport.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
#include <linux/uaccess.h>
|
|
||||||
|
|
||||||
/* software control endianness */
|
|
||||||
#define PEEK32(addr) readl(addr + mmio750)
|
|
||||||
#define POKE32(addr, data) writel(data, addr + mmio750)
|
|
||||||
|
|
||||||
extern void __iomem *mmio750;
|
|
||||||
extern char revId750;
|
|
||||||
extern unsigned short devId750;
|
|
||||||
#else
|
|
||||||
/* implement if you want use it*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define USE_HW_I2C
|
#define USE_HW_I2C
|
||||||
#ifdef USE_HW_I2C
|
#ifdef USE_HW_I2C
|
||||||
#include "ddk750_help.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_hwi2c.h"
|
#include "ddk750_hwi2c.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
#include "ddk750_help.h"
|
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_mode.h"
|
#include "ddk750_mode.h"
|
||||||
#include "ddk750_chip.h"
|
#include "ddk750_chip.h"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "ddk750_help.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* implementation.
|
* implementation.
|
||||||
*
|
*
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
#include "ddk750_help.h"
|
#include "ddk750_chip.h"
|
||||||
#include "ddk750_reg.h"
|
#include "ddk750_reg.h"
|
||||||
#include "ddk750_swi2c.h"
|
#include "ddk750_swi2c.h"
|
||||||
#include "ddk750_power.h"
|
#include "ddk750_power.h"
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "ddk750.h"
|
#include "ddk750.h"
|
||||||
#include "sm750_accel.h"
|
#include "sm750_accel.h"
|
||||||
|
|
||||||
|
void __iomem *mmio750;
|
||||||
|
|
||||||
int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
|
int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -59,7 +61,8 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
|
||||||
sm750_dev->accel.dprBase = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
|
sm750_dev->accel.dprBase = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
|
||||||
sm750_dev->accel.dpPortBase = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
|
sm750_dev->accel.dpPortBase = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
|
||||||
|
|
||||||
ddk750_set_mmio(sm750_dev->pvReg, sm750_dev->devid, sm750_dev->revid);
|
mmio750 = sm750_dev->pvReg;
|
||||||
|
sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
|
||||||
|
|
||||||
sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
|
sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
|
||||||
/* don't use pdev_resource[x].end - resource[x].start to
|
/* don't use pdev_resource[x].end - resource[x].start to
|
||||||
|
|
Loading…
Reference in New Issue