Commit 6625f55c authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/clk: convert to new-style nvkm_subdev

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent bb23f9d7
...@@ -55,7 +55,7 @@ u64 nvif_device_time(struct nvif_device *); ...@@ -55,7 +55,7 @@ u64 nvif_device_time(struct nvif_device *);
#define nvxx_mmu(a) nvkm_mmu(nvxx_device(a)) #define nvxx_mmu(a) nvkm_mmu(nvxx_device(a))
#define nvxx_bar(a) nvxx_device(a)->bar #define nvxx_bar(a) nvxx_device(a)->bar
#define nvxx_gpio(a) nvkm_gpio(nvxx_device(a)) #define nvxx_gpio(a) nvkm_gpio(nvxx_device(a))
#define nvxx_clk(a) nvkm_clk(nvxx_device(a)) #define nvxx_clk(a) nvxx_device(a)->clk
#define nvxx_i2c(a) nvkm_i2c(nvxx_device(a)) #define nvxx_i2c(a) nvkm_i2c(nvxx_device(a))
#define nvxx_therm(a) nvkm_therm(nvxx_device(a)) #define nvxx_therm(a) nvkm_therm(nvxx_device(a))
......
...@@ -71,9 +71,10 @@ struct nvkm_domain { ...@@ -71,9 +71,10 @@ struct nvkm_domain {
}; };
struct nvkm_clk { struct nvkm_clk {
const struct nvkm_clk_func *func;
struct nvkm_subdev subdev; struct nvkm_subdev subdev;
struct nvkm_domain *domains; const struct nvkm_domain *domains;
struct nvkm_pstate bstate; struct nvkm_pstate bstate;
struct list_head states; struct list_head states;
...@@ -94,68 +95,27 @@ struct nvkm_clk { ...@@ -94,68 +95,27 @@ struct nvkm_clk {
bool allow_reclock; bool allow_reclock;
int (*read)(struct nvkm_clk *, enum nv_clk_src);
int (*calc)(struct nvkm_clk *, struct nvkm_cstate *);
int (*prog)(struct nvkm_clk *);
void (*tidy)(struct nvkm_clk *);
/*XXX: die, these are here *only* to support the completely /*XXX: die, these are here *only* to support the completely
* bat-shit insane what-was-nvkm_hw.c code * bat-shit insane what-was-nouveau_hw.c code
*/ */
int (*pll_calc)(struct nvkm_clk *, struct nvbios_pll *, int clk, int (*pll_calc)(struct nvkm_clk *, struct nvbios_pll *, int clk,
struct nvkm_pll_vals *pv); struct nvkm_pll_vals *pv);
int (*pll_prog)(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *pv); int (*pll_prog)(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *pv);
}; };
static inline struct nvkm_clk * int nvkm_clk_read(struct nvkm_clk *, enum nv_clk_src);
nvkm_clk(void *obj)
{
return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_CLK);
}
#define nvkm_clk_create(p,e,o,i,r,s,n,d) \
nvkm_clk_create_((p), (e), (o), (i), (r), (s), (n), sizeof(**d), \
(void **)d)
#define nvkm_clk_destroy(p) ({ \
struct nvkm_clk *_clk = (p); \
_nvkm_clk_dtor(nv_object(_clk)); \
})
#define nvkm_clk_init(p) ({ \
struct nvkm_clk *_clk = (p); \
_nvkm_clk_init(nv_object(_clk)); \
})
#define nvkm_clk_fini(p,s) ({ \
struct nvkm_clk *_clk = (p); \
_nvkm_clk_fini(nv_object(_clk), (s)); \
})
int nvkm_clk_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *,
struct nvkm_domain *, struct nvkm_pstate *,
int, bool, int, void **);
void _nvkm_clk_dtor(struct nvkm_object *);
int _nvkm_clk_init(struct nvkm_object *);
int _nvkm_clk_fini(struct nvkm_object *, bool);
extern struct nvkm_oclass nv04_clk_oclass;
extern struct nvkm_oclass nv40_clk_oclass;
extern struct nvkm_oclass *nv50_clk_oclass;
extern struct nvkm_oclass *g84_clk_oclass;
extern struct nvkm_oclass *mcp77_clk_oclass;
extern struct nvkm_oclass gt215_clk_oclass;
extern struct nvkm_oclass gf100_clk_oclass;
extern struct nvkm_oclass gk104_clk_oclass;
extern struct nvkm_oclass gk20a_clk_oclass;
int nv04_clk_pll_set(struct nvkm_clk *, u32 type, u32 freq);
int nv04_clk_pll_calc(struct nvkm_clk *, struct nvbios_pll *, int clk,
struct nvkm_pll_vals *);
int nv04_clk_pll_prog(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *);
int gt215_clk_pll_calc(struct nvkm_clk *, struct nvbios_pll *,
int clk, struct nvkm_pll_vals *);
int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr); int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr);
int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait); int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait);
int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel); int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel);
int nvkm_clk_tstate(struct nvkm_clk *, int req, int rel); int nvkm_clk_tstate(struct nvkm_clk *, int req, int rel);
int nv04_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int nv40_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int nv50_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int g84_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int mcp77_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int gt215_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int gf100_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int gk104_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
int gk20a_clk_new(struct nvkm_device *, int, struct nvkm_clk **);
#endif #endif
...@@ -70,7 +70,7 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size) ...@@ -70,7 +70,7 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size)
struct nvif_control_pstate_attr_v0 v0; struct nvif_control_pstate_attr_v0 v0;
} *args = data; } *args = data;
struct nvkm_clk *clk = ctrl->device->clk; struct nvkm_clk *clk = ctrl->device->clk;
struct nvkm_domain *domain; const struct nvkm_domain *domain;
struct nvkm_pstate *pstate; struct nvkm_pstate *pstate;
struct nvkm_cstate *cstate; struct nvkm_cstate *cstate;
int i = 0, j = -1; int i = 0, j = -1;
...@@ -116,7 +116,7 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size) ...@@ -116,7 +116,7 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size)
args->v0.state = pstate->pstate; args->v0.state = pstate->pstate;
} else { } else {
lo = max(clk->read(clk, domain->name), 0); lo = max(nvkm_clk_read(clk, domain->name), 0);
hi = lo; hi = lo;
} }
......
...@@ -31,7 +31,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -31,7 +31,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -60,7 +59,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -60,7 +59,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -89,7 +87,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -89,7 +87,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -117,7 +114,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -117,7 +114,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -146,7 +142,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -146,7 +142,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -174,7 +169,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -174,7 +169,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -202,7 +196,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -202,7 +196,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -231,7 +224,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -231,7 +224,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -259,7 +251,6 @@ gf100_identify(struct nvkm_device *device) ...@@ -259,7 +251,6 @@ gf100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
......
...@@ -31,7 +31,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -31,7 +31,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -61,7 +60,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -61,7 +60,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -91,7 +89,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -91,7 +89,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -118,7 +115,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -118,7 +115,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass; device->oclass[NVDEV_ENGINE_PM ] = gk104_pm_oclass;
break; break;
case 0xea: case 0xea:
device->oclass[NVDEV_SUBDEV_CLK ] = &gk20a_clk_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass;
...@@ -140,7 +136,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -140,7 +136,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -170,7 +165,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -170,7 +165,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -200,7 +194,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -200,7 +194,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
...@@ -229,7 +222,6 @@ gk104_identify(struct nvkm_device *device) ...@@ -229,7 +222,6 @@ gk104_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
......
...@@ -31,7 +31,6 @@ gm100_identify(struct nvkm_device *device) ...@@ -31,7 +31,6 @@ gm100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gm107_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gm107_devinit_oclass;
...@@ -69,7 +68,6 @@ gm100_identify(struct nvkm_device *device) ...@@ -69,7 +68,6 @@ gm100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass;
#if 0 #if 0
/* looks to be some non-trivial changes */ /* looks to be some non-trivial changes */
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
/* priv ring says no to 0x10eb14 writes */ /* priv ring says no to 0x10eb14 writes */
device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass;
#endif #endif
...@@ -106,7 +104,6 @@ gm100_identify(struct nvkm_device *device) ...@@ -106,7 +104,6 @@ gm100_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass;
#if 0 #if 0
/* looks to be some non-trivial changes */ /* looks to be some non-trivial changes */
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
/* priv ring says no to 0x10eb14 writes */ /* priv ring says no to 0x10eb14 writes */
device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass;
#endif #endif
......
...@@ -29,7 +29,6 @@ nv04_identify(struct nvkm_device *device) ...@@ -29,7 +29,6 @@ nv04_identify(struct nvkm_device *device)
switch (device->chipset) { switch (device->chipset) {
case 0x04: case 0x04:
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv04_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv04_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -44,7 +43,6 @@ nv04_identify(struct nvkm_device *device) ...@@ -44,7 +43,6 @@ nv04_identify(struct nvkm_device *device)
break; break;
case 0x05: case 0x05:
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv05_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv05_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
......
...@@ -30,7 +30,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -30,7 +30,6 @@ nv10_identify(struct nvkm_device *device)
case 0x10: case 0x10:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -44,7 +43,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -44,7 +43,6 @@ nv10_identify(struct nvkm_device *device)
case 0x15: case 0x15:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -60,7 +58,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -60,7 +58,6 @@ nv10_identify(struct nvkm_device *device)
case 0x16: case 0x16:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -76,7 +73,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -76,7 +73,6 @@ nv10_identify(struct nvkm_device *device)
case 0x1a: case 0x1a:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -92,7 +88,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -92,7 +88,6 @@ nv10_identify(struct nvkm_device *device)
case 0x11: case 0x11:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -108,7 +103,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -108,7 +103,6 @@ nv10_identify(struct nvkm_device *device)
case 0x17: case 0x17:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -124,7 +118,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -124,7 +118,6 @@ nv10_identify(struct nvkm_device *device)
case 0x1f: case 0x1f:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -140,7 +133,6 @@ nv10_identify(struct nvkm_device *device) ...@@ -140,7 +133,6 @@ nv10_identify(struct nvkm_device *device)
case 0x18: case 0x18:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
......
...@@ -30,7 +30,6 @@ nv20_identify(struct nvkm_device *device) ...@@ -30,7 +30,6 @@ nv20_identify(struct nvkm_device *device)
case 0x20: case 0x20:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -46,7 +45,6 @@ nv20_identify(struct nvkm_device *device) ...@@ -46,7 +45,6 @@ nv20_identify(struct nvkm_device *device)
case 0x25: case 0x25:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -62,7 +60,6 @@ nv20_identify(struct nvkm_device *device) ...@@ -62,7 +60,6 @@ nv20_identify(struct nvkm_device *device)
case 0x28: case 0x28:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -78,7 +75,6 @@ nv20_identify(struct nvkm_device *device) ...@@ -78,7 +75,6 @@ nv20_identify(struct nvkm_device *device)
case 0x2a: case 0x2a:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
......
...@@ -30,7 +30,6 @@ nv30_identify(struct nvkm_device *device) ...@@ -30,7 +30,6 @@ nv30_identify(struct nvkm_device *device)
case 0x30: case 0x30:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -46,7 +45,6 @@ nv30_identify(struct nvkm_device *device) ...@@ -46,7 +45,6 @@ nv30_identify(struct nvkm_device *device)
case 0x35: case 0x35:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -62,7 +60,6 @@ nv30_identify(struct nvkm_device *device) ...@@ -62,7 +60,6 @@ nv30_identify(struct nvkm_device *device)
case 0x31: case 0x31:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -79,7 +76,6 @@ nv30_identify(struct nvkm_device *device) ...@@ -79,7 +76,6 @@ nv30_identify(struct nvkm_device *device)
case 0x36: case 0x36:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv20_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
...@@ -96,7 +92,6 @@ nv30_identify(struct nvkm_device *device) ...@@ -96,7 +92,6 @@ nv30_identify(struct nvkm_device *device)
case 0x34: case 0x34:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv04_clk_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv10_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv04_mc_oclass;
device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
......
...@@ -30,7 +30,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -30,7 +30,6 @@ nv40_identify(struct nvkm_device *device)
case 0x40: case 0x40:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -50,7 +49,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -50,7 +49,6 @@ nv40_identify(struct nvkm_device *device)
case 0x41: case 0x41:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -70,7 +68,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -70,7 +68,6 @@ nv40_identify(struct nvkm_device *device)
case 0x42: case 0x42:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -90,7 +87,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -90,7 +87,6 @@ nv40_identify(struct nvkm_device *device)
case 0x43: case 0x43:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -110,7 +106,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -110,7 +106,6 @@ nv40_identify(struct nvkm_device *device)
case 0x45: case 0x45:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -130,7 +125,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -130,7 +125,6 @@ nv40_identify(struct nvkm_device *device)
case 0x47: case 0x47:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -150,7 +144,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -150,7 +144,6 @@ nv40_identify(struct nvkm_device *device)
case 0x49: case 0x49:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -170,7 +163,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -170,7 +163,6 @@ nv40_identify(struct nvkm_device *device)
case 0x4b: case 0x4b:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv40_mc_oclass;
...@@ -190,7 +182,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -190,7 +182,6 @@ nv40_identify(struct nvkm_device *device)
case 0x44: case 0x44:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass;
...@@ -210,7 +201,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -210,7 +201,6 @@ nv40_identify(struct nvkm_device *device)
case 0x46: case 0x46:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
...@@ -230,7 +220,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -230,7 +220,6 @@ nv40_identify(struct nvkm_device *device)
case 0x4a: case 0x4a:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass;
...@@ -250,7 +239,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -250,7 +239,6 @@ nv40_identify(struct nvkm_device *device)
case 0x4c: case 0x4c:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
...@@ -270,7 +258,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -270,7 +258,6 @@ nv40_identify(struct nvkm_device *device)
case 0x4e: case 0x4e:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv4e_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv4e_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
...@@ -290,7 +277,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -290,7 +277,6 @@ nv40_identify(struct nvkm_device *device)
case 0x63: case 0x63:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
...@@ -310,7 +296,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -310,7 +296,6 @@ nv40_identify(struct nvkm_device *device)
case 0x67: case 0x67:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
...@@ -330,7 +315,6 @@ nv40_identify(struct nvkm_device *device) ...@@ -330,7 +315,6 @@ nv40_identify(struct nvkm_device *device)
case 0x68: case 0x68:
device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv10_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv04_i2c_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
......
...@@ -31,7 +31,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -31,7 +31,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = nv50_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = nv50_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = nv50_devinit_oclass;
...@@ -53,7 +52,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -53,7 +52,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -78,7 +76,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -78,7 +76,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -103,7 +100,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -103,7 +100,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -128,7 +124,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -128,7 +124,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -153,7 +148,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -153,7 +148,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -178,7 +172,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -178,7 +172,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
...@@ -203,7 +196,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -203,7 +196,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
...@@ -228,7 +220,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -228,7 +220,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
...@@ -253,7 +244,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -253,7 +244,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
...@@ -278,7 +268,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -278,7 +268,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
...@@ -305,7 +294,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -305,7 +294,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
...@@ -331,7 +319,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -331,7 +319,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
...@@ -357,7 +344,6 @@ nv50_identify(struct nvkm_device *device) ...@@ -357,7 +344,6 @@ nv50_identify(struct nvkm_device *device)
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass;
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gt215_therm_oclass;
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
device->oclass[NVDEV_SUBDEV_DEVINIT] = mcp89_devinit_oclass; device->oclass[NVDEV_SUBDEV_DEVINIT] = mcp89_devinit_oclass;
......
...@@ -8,5 +8,6 @@ nvkm-y += nvkm/subdev/clk/mcp77.o ...@@ -8,5 +8,6 @@ nvkm-y += nvkm/subdev/clk/mcp77.o
nvkm-y += nvkm/subdev/clk/gf100.o nvkm-y += nvkm/subdev/clk/gf100.o
nvkm-y += nvkm/subdev/clk/gk104.o nvkm-y += nvkm/subdev/clk/gk104.o
nvkm-y += nvkm/subdev/clk/gk20a.o nvkm-y += nvkm/subdev/clk/gk20a.o
nvkm-y += nvkm/subdev/clk/pllnv04.o nvkm-y += nvkm/subdev/clk/pllnv04.o
nvkm-y += nvkm/subdev/clk/pllgt215.o nvkm-y += nvkm/subdev/clk/pllgt215.o
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/clk.h> #include "priv.h"
#include <subdev/bios.h> #include <subdev/bios.h>
#include <subdev/bios/boost.h> #include <subdev/bios/boost.h>
#include <subdev/bios/cstep.h> #include <subdev/bios/cstep.h>
...@@ -105,10 +106,10 @@ nvkm_cstate_prog(struct nvkm_clk *clk, struct nvkm_pstate *pstate, int cstatei) ...@@ -105,10 +106,10 @@ nvkm_cstate_prog(struct nvkm_clk *clk, struct nvkm_pstate *pstate, int cstatei)
} }
} }
ret = clk->calc(clk, cstate); ret = clk->func->calc(clk, cstate);
if (ret == 0) { if (ret == 0) {
ret = clk->prog(clk); ret = clk->func->prog(clk);
clk->tidy(clk); clk->func->tidy(clk);
} }
if (volt) { if (volt) {
...@@ -137,7 +138,7 @@ static int ...@@ -137,7 +138,7 @@ static int
nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate) nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
{ {
struct nvkm_bios *bios = clk->subdev.device->bios; struct nvkm_bios *bios = clk->subdev.device->bios;
struct nvkm_domain *domain = clk->domains; const struct nvkm_domain *domain = clk->domains;
struct nvkm_cstate *cstate = NULL; struct nvkm_cstate *cstate = NULL;
struct nvbios_cstepX cstepX; struct nvbios_cstepX cstepX;
u8 ver, hdr; u8 ver, hdr;
...@@ -249,7 +250,7 @@ nvkm_pstate_calc(struct nvkm_clk *clk, bool wait) ...@@ -249,7 +250,7 @@ nvkm_pstate_calc(struct nvkm_clk *clk, bool wait)
static void static void
nvkm_pstate_info(struct nvkm_clk *clk, struct nvkm_pstate *pstate) nvkm_pstate_info(struct nvkm_clk *clk, struct nvkm_pstate *pstate)
{ {
struct nvkm_domain *clock = clk->domains - 1; const struct nvkm_domain *clock = clk->domains - 1;
struct nvkm_cstate *cstate; struct nvkm_cstate *cstate;
struct nvkm_subdev *subdev = &clk->subdev; struct nvkm_subdev *subdev = &clk->subdev;
char info[3][32] = { "", "", "" }; char info[3][32] = { "", "", "" };
...@@ -306,7 +307,7 @@ static int ...@@ -306,7 +307,7 @@ static int
nvkm_pstate_new(struct nvkm_clk *clk, int idx) nvkm_pstate_new(struct nvkm_clk *clk, int idx)
{ {
struct nvkm_bios *bios = clk->subdev.device->bios; struct nvkm_bios *bios = clk->subdev.device->bios;
struct nvkm_domain *domain = clk->domains - 1; const struct nvkm_domain *domain = clk->domains - 1;
struct nvkm_pstate *pstate; struct nvkm_pstate *pstate;
struct nvkm_cstate *cstate; struct nvkm_cstate *cstate;
struct nvbios_cstepE cstepE; struct nvbios_cstepE cstepE;
...@@ -475,31 +476,35 @@ nvkm_clk_pwrsrc(struct nvkm_notify *notify) ...@@ -475,31 +476,35 @@ nvkm_clk_pwrsrc(struct nvkm_notify *notify)
*****************************************************************************/ *****************************************************************************/
int int
_nvkm_clk_fini(struct nvkm_object *object, bool suspend) nvkm_clk_read(struct nvkm_clk *clk, enum nv_clk_src src)
{ {
struct nvkm_clk *clk = (void *)object; return clk->func->read(clk, src);
}
static int
nvkm_clk_fini(struct nvkm_subdev *subdev, bool suspend)
{
struct nvkm_clk *clk = nvkm_clk(subdev);
nvkm_notify_put(&clk->pwrsrc_ntfy); nvkm_notify_put(&clk->pwrsrc_ntfy);
return nvkm_subdev_fini_old(&clk->subdev, suspend); flush_work(&clk->work);
if (clk->func->fini)
clk->func->fini(clk);
return 0;
} }
int static int
_nvkm_clk_init(struct nvkm_object *object) nvkm_clk_init(struct nvkm_subdev *subdev)
{ {
struct nvkm_clk *clk = (void *)object; struct nvkm_clk *clk = nvkm_clk(subdev);
struct nvkm_subdev *subdev = &clk->subdev; const struct nvkm_domain *clock = clk->domains;
struct nvkm_domain *clock = clk->domains;
int ret; int ret;
ret = nvkm_subdev_init_old(&clk->subdev);
if (ret)
return ret;
memset(&clk->bstate, 0x00, sizeof(clk->bstate)); memset(&clk->bstate, 0x00, sizeof(clk->bstate));
INIT_LIST_HEAD(&clk->bstate.list); INIT_LIST_HEAD(&clk->bstate.list);
clk->bstate.pstate = 0xff; clk->bstate.pstate = 0xff;
while (clock->name != nv_clk_src_max) { while (clock->name != nv_clk_src_max) {
ret = clk->read(clk, clock->name); ret = nvkm_clk_read(clk, clock->name);
if (ret < 0) { if (ret < 0) {
nvkm_error(subdev, "%02x freq unknown\n", clock->name); nvkm_error(subdev, "%02x freq unknown\n", clock->name);
return ret; return ret;
...@@ -510,6 +515,9 @@ _nvkm_clk_init(struct nvkm_object *object) ...@@ -510,6 +515,9 @@ _nvkm_clk_init(struct nvkm_object *object)
nvkm_pstate_info(clk, &clk->bstate); nvkm_pstate_info(clk, &clk->bstate);
if (clk->func->init)
return clk->func->init(clk);
clk->astate = clk->state_nr - 1; clk->astate = clk->state_nr - 1;
clk->tstate = 0; clk->tstate = 0;
clk->dstate = 0; clk->dstate = 0;
...@@ -518,61 +526,63 @@ _nvkm_clk_init(struct nvkm_object *object) ...@@ -518,61 +526,63 @@ _nvkm_clk_init(struct nvkm_object *object)
return 0; return 0;
} }
void static void *
_nvkm_clk_dtor(struct nvkm_object *object) nvkm_clk_dtor(struct nvkm_subdev *subdev)
{ {
struct nvkm_clk *clk = (void *)object; struct nvkm_clk *clk = nvkm_clk(subdev);
struct nvkm_pstate *pstate, *temp; struct nvkm_pstate *pstate, *temp;
nvkm_notify_fini(&clk->pwrsrc_ntfy); nvkm_notify_fini(&clk->pwrsrc_ntfy);
/* Early return if the pstates have been provided statically */
if (clk->func->pstates)
return clk;
list_for_each_entry_safe(pstate, temp, &clk->states, head) { list_for_each_entry_safe(pstate, temp, &clk->states, head) {
nvkm_pstate_del(pstate); nvkm_pstate_del(pstate);
} }
nvkm_subdev_destroy(&clk->subdev); return clk;
} }
static const struct nvkm_subdev_func
nvkm_clk = {
.dtor = nvkm_clk_dtor,
.init = nvkm_clk_init,
.fini = nvkm_clk_fini,
};
int int
nvkm_clk_create_(struct nvkm_object *parent, struct nvkm_object *engine, nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device,
struct nvkm_oclass *oclass, struct nvkm_domain *clocks, int index, bool allow_reclock, struct nvkm_clk *clk)
struct nvkm_pstate *pstates, int nb_pstates,
bool allow_reclock, int length, void **object)
{ {
struct nvkm_device *device = nv_device(parent);
struct nvkm_clk *clk;
int ret, idx, arglen; int ret, idx, arglen;
const char *mode; const char *mode;
ret = nvkm_subdev_create_(parent, engine, oclass, 0, "CLK", nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev);
"clock", length, object); clk->func = func;
clk = *object;
if (ret)
return ret;
INIT_LIST_HEAD(&clk->states); INIT_LIST_HEAD(&clk->states);
clk->domains = clocks; clk->domains = func->domains;
clk->ustate_ac = -1; clk->ustate_ac = -1;
clk->ustate_dc = -1; clk->ustate_dc = -1;
clk->allow_reclock = allow_reclock;
INIT_WORK(&clk->work, nvkm_pstate_work); INIT_WORK(&clk->work, nvkm_pstate_work);
init_waitqueue_head(&clk->wait); init_waitqueue_head(&clk->wait);
atomic_set(&clk->waiting, 0); atomic_set(&clk->waiting, 0);
/* If no pstates are provided, try and fetch them from the BIOS */ /* If no pstates are provided, try and fetch them from the BIOS */
if (!pstates) { if (!func->pstates) {
idx = 0; idx = 0;
do { do {
ret = nvkm_pstate_new(clk, idx++); ret = nvkm_pstate_new(clk, idx++);
} while (ret == 0); } while (ret == 0);
} else { } else {
for (idx = 0; idx < nb_pstates; idx++) for (idx = 0; idx < func->nr_pstates; idx++)
list_add_tail(&pstates[idx].head, &clk->states); list_add_tail(&func->pstates[idx].head, &clk->states);
clk->state_nr = nb_pstates; clk->state_nr = func->nr_pstates;
} }
clk->allow_reclock = allow_reclock;
ret = nvkm_notify_init(NULL, &device->event, nvkm_clk_pwrsrc, true, ret = nvkm_notify_init(NULL, &device->event, nvkm_clk_pwrsrc, true,
NULL, 0, 0, &clk->pwrsrc_ntfy); NULL, 0, 0, &clk->pwrsrc_ntfy);
if (ret) if (ret)
...@@ -594,3 +604,12 @@ nvkm_clk_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -594,3 +604,12 @@ nvkm_clk_create_(struct nvkm_object *parent, struct nvkm_object *engine,
return 0; return 0;
} }
int
nvkm_clk_new_(const struct nvkm_clk_func *func, struct nvkm_device *device,
int index, bool allow_reclock, struct nvkm_clk **pclk)
{
if (!(*pclk = kzalloc(sizeof(**pclk), GFP_KERNEL)))
return -ENOMEM;
return nvkm_clk_ctor(func, device, index, allow_reclock, *pclk);
}
...@@ -23,25 +23,26 @@ ...@@ -23,25 +23,26 @@
*/ */
#include "nv50.h" #include "nv50.h"
static struct nvkm_domain static const struct nvkm_clk_func
g84_domains[] = { g84_clk = {
{ nv_clk_src_crystal, 0xff }, .read = nv50_clk_read,
{ nv_clk_src_href , 0xff }, .calc = nv50_clk_calc,
{ nv_clk_src_core , 0xff, 0, "core", 1000 }, .prog = nv50_clk_prog,
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 }, .tidy = nv50_clk_tidy,
{ nv_clk_src_mem , 0xff, 0, "memory", 1000 }, .domains = {
{ nv_clk_src_vdec , 0xff }, { nv_clk_src_crystal, 0xff },
{ nv_clk_src_max } { nv_clk_src_href , 0xff },
{ nv_clk_src_core , 0xff, 0, "core", 1000 },
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 },
{ nv_clk_src_mem , 0xff, 0, "memory", 1000 },
{ nv_clk_src_vdec , 0xff },
{ nv_clk_src_max }
}
}; };
struct nvkm_oclass * int
g84_clk_oclass = &(struct nv50_clk_oclass) { g84_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
.base.handle = NV_SUBDEV(CLK, 0x84), {
.base.ofuncs = &(struct nvkm_ofuncs) { return nv50_clk_new_(&g84_clk, device, index,
.ctor = nv50_clk_ctor, (device->chipset == 0xa0), pclk);
.dtor = _nvkm_clk_dtor, }
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
.domains = g84_domains,
}.base;
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/clk.h> #define gf100_clk(p) container_of((p), struct gf100_clk, base)
#include "priv.h"
#include "pll.h" #include "pll.h"
#include <subdev/bios.h> #include <subdev/bios.h>
...@@ -50,8 +51,8 @@ read_vco(struct gf100_clk *clk, u32 dsrc) ...@@ -50,8 +51,8 @@ read_vco(struct gf100_clk *clk, u32 dsrc)
struct nvkm_device *device = clk->base.subdev.device; struct nvkm_device *device = clk->base.subdev.device;
u32 ssrc = nvkm_rd32(device, dsrc); u32 ssrc = nvkm_rd32(device, dsrc);
if (!(ssrc & 0x00000100)) if (!(ssrc & 0x00000100))
return clk->base.read(&clk->base, nv_clk_src_sppll0); return nvkm_clk_read(&clk->base, nv_clk_src_sppll0);
return clk->base.read(&clk->base, nv_clk_src_sppll1); return nvkm_clk_read(&clk->base, nv_clk_src_sppll1);
} }
static u32 static u32
...@@ -75,10 +76,10 @@ read_pll(struct gf100_clk *clk, u32 pll) ...@@ -75,10 +76,10 @@ read_pll(struct gf100_clk *clk, u32 pll)
P = 1; P = 1;
break; break;
case 0x132000: case 0x132000:
sclk = clk->base.read(&clk->base, nv_clk_src_mpllsrc); sclk = nvkm_clk_read(&clk->base, nv_clk_src_mpllsrc);
break; break;
case 0x132020: case 0x132020:
sclk = clk->base.read(&clk->base, nv_clk_src_mpllsrcref); sclk = nvkm_clk_read(&clk->base, nv_clk_src_mpllsrcref);
break; break;
case 0x137000: case 0x137000:
case 0x137020: case 0x137020:
...@@ -146,9 +147,9 @@ read_clk(struct gf100_clk *clk, int idx) ...@@ -146,9 +147,9 @@ read_clk(struct gf100_clk *clk, int idx)
} }
static int static int
gf100_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) gf100_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct gf100_clk *clk = container_of(obj, typeof(*clk), base); struct gf100_clk *clk = gf100_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
...@@ -172,8 +173,8 @@ gf100_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -172,8 +173,8 @@ gf100_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
return read_div(clk, 0, 0x137300, 0x137310); return read_div(clk, 0, 0x137300, 0x137310);
case nv_clk_src_mem: case nv_clk_src_mem:
if (nvkm_rd32(device, 0x1373f0) & 0x00000002) if (nvkm_rd32(device, 0x1373f0) & 0x00000002)
return clk->base.read(&clk->base, nv_clk_src_mpll); return nvkm_clk_read(&clk->base, nv_clk_src_mpll);
return clk->base.read(&clk->base, nv_clk_src_mdiv); return nvkm_clk_read(&clk->base, nv_clk_src_mdiv);
case nv_clk_src_gpc: case nv_clk_src_gpc:
return read_clk(clk, 0x00); return read_clk(clk, 0x00);
...@@ -313,9 +314,9 @@ calc_clk(struct gf100_clk *clk, struct nvkm_cstate *cstate, int idx, int dom) ...@@ -313,9 +314,9 @@ calc_clk(struct gf100_clk *clk, struct nvkm_cstate *cstate, int idx, int dom)
} }
static int static int
gf100_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) gf100_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct gf100_clk *clk = container_of(obj, typeof(*clk), base); struct gf100_clk *clk = gf100_clk(base);
int ret; int ret;
if ((ret = calc_clk(clk, cstate, 0x00, nv_clk_src_gpc)) || if ((ret = calc_clk(clk, cstate, 0x00, nv_clk_src_gpc)) ||
...@@ -398,9 +399,9 @@ gf100_clk_prog_4(struct gf100_clk *clk, int idx) ...@@ -398,9 +399,9 @@ gf100_clk_prog_4(struct gf100_clk *clk, int idx)
} }
static int static int
gf100_clk_prog(struct nvkm_clk *obj) gf100_clk_prog(struct nvkm_clk *base)
{ {
struct gf100_clk *clk = container_of(obj, typeof(*clk), base); struct gf100_clk *clk = gf100_clk(base);
struct { struct {
void (*exec)(struct gf100_clk *, int); void (*exec)(struct gf100_clk *, int);
} stage[] = { } stage[] = {
...@@ -424,56 +425,42 @@ gf100_clk_prog(struct nvkm_clk *obj) ...@@ -424,56 +425,42 @@ gf100_clk_prog(struct nvkm_clk *obj)
} }
static void static void
gf100_clk_tidy(struct nvkm_clk *obj) gf100_clk_tidy(struct nvkm_clk *base)
{ {
struct gf100_clk *clk = container_of(obj, typeof(*clk), base); struct gf100_clk *clk = gf100_clk(base);
memset(clk->eng, 0x00, sizeof(clk->eng)); memset(clk->eng, 0x00, sizeof(clk->eng));
} }
static struct nvkm_domain static const struct nvkm_clk_func
gf100_domain[] = { gf100_clk = {
{ nv_clk_src_crystal, 0xff }, .read = gf100_clk_read,
{ nv_clk_src_href , 0xff }, .calc = gf100_clk_calc,
{ nv_clk_src_hubk06 , 0x00 }, .prog = gf100_clk_prog,
{ nv_clk_src_hubk01 , 0x01 }, .tidy = gf100_clk_tidy,
{ nv_clk_src_copy , 0x02 }, .domains = {
{ nv_clk_src_gpc , 0x03, 0, "core", 2000 }, { nv_clk_src_crystal, 0xff },
{ nv_clk_src_rop , 0x04 }, { nv_clk_src_href , 0xff },
{ nv_clk_src_mem , 0x05, 0, "memory", 1000 }, { nv_clk_src_hubk06 , 0x00 },
{ nv_clk_src_vdec , 0x06 }, { nv_clk_src_hubk01 , 0x01 },
{ nv_clk_src_daemon , 0x0a }, { nv_clk_src_copy , 0x02 },
{ nv_clk_src_hubk07 , 0x0b }, { nv_clk_src_gpc , 0x03, 0, "core", 2000 },
{ nv_clk_src_max } { nv_clk_src_rop , 0x04 },
{ nv_clk_src_mem , 0x05, 0, "memory", 1000 },
{ nv_clk_src_vdec , 0x06 },
{ nv_clk_src_daemon , 0x0a },
{ nv_clk_src_hubk07 , 0x0b },
{ nv_clk_src_max }
}
}; };
static int int
gf100_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, gf100_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{ {
struct gf100_clk *clk; struct gf100_clk *clk;
int ret;
ret = nvkm_clk_create(parent, engine, oclass, gf100_domain, if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
NULL, 0, false, &clk); return -ENOMEM;
*pobject = nv_object(clk); *pclk = &clk->base;
if (ret)
return ret;
clk->base.read = gf100_clk_read; return nvkm_clk_ctor(&gf100_clk, device, index, false, &clk->base);
clk->base.calc = gf100_clk_calc;
clk->base.prog = gf100_clk_prog;
clk->base.tidy = gf100_clk_tidy;
return 0;
} }
struct nvkm_oclass
gf100_clk_oclass = {
.handle = NV_SUBDEV(CLK, 0xc0),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gf100_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/clk.h> #define gk104_clk(p) container_of((p), struct gk104_clk, base)
#include "priv.h"
#include "pll.h" #include "pll.h"
#include <subdev/timer.h> #include <subdev/timer.h>
...@@ -185,9 +186,9 @@ read_clk(struct gk104_clk *clk, int idx) ...@@ -185,9 +186,9 @@ read_clk(struct gk104_clk *clk, int idx)
} }
static int static int
gk104_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) gk104_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct gk104_clk *clk = container_of(obj, typeof(*clk), base); struct gk104_clk *clk = gk104_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
...@@ -335,9 +336,9 @@ calc_clk(struct gk104_clk *clk, ...@@ -335,9 +336,9 @@ calc_clk(struct gk104_clk *clk,
} }
static int static int
gk104_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) gk104_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct gk104_clk *clk = container_of(obj, typeof(*clk), base); struct gk104_clk *clk = gk104_clk(base);
int ret; int ret;
if ((ret = calc_clk(clk, cstate, 0x00, nv_clk_src_gpc)) || if ((ret = calc_clk(clk, cstate, 0x00, nv_clk_src_gpc)) ||
...@@ -438,9 +439,9 @@ gk104_clk_prog_4_1(struct gk104_clk *clk, int idx) ...@@ -438,9 +439,9 @@ gk104_clk_prog_4_1(struct gk104_clk *clk, int idx)
} }
static int static int
gk104_clk_prog(struct nvkm_clk *obj) gk104_clk_prog(struct nvkm_clk *base)
{ {
struct gk104_clk *clk = container_of(obj, typeof(*clk), base); struct gk104_clk *clk = gk104_clk(base);
struct { struct {
u32 mask; u32 mask;
void (*exec)(struct gk104_clk *, int); void (*exec)(struct gk104_clk *, int);
...@@ -469,55 +470,41 @@ gk104_clk_prog(struct nvkm_clk *obj) ...@@ -469,55 +470,41 @@ gk104_clk_prog(struct nvkm_clk *obj)
} }
static void static void
gk104_clk_tidy(struct nvkm_clk *obj) gk104_clk_tidy(struct nvkm_clk *base)
{ {
struct gk104_clk *clk = container_of(obj, typeof(*clk), base); struct gk104_clk *clk = gk104_clk(base);
memset(clk->eng, 0x00, sizeof(clk->eng)); memset(clk->eng, 0x00, sizeof(clk->eng));
} }
static struct nvkm_domain static const struct nvkm_clk_func
gk104_domain[] = { gk104_clk = {
{ nv_clk_src_crystal, 0xff }, .read = gk104_clk_read,
{ nv_clk_src_href , 0xff }, .calc = gk104_clk_calc,
{ nv_clk_src_gpc , 0x00, NVKM_CLK_DOM_FLAG_CORE, "core", 2000 }, .prog = gk104_clk_prog,
{ nv_clk_src_hubk07 , 0x01, NVKM_CLK_DOM_FLAG_CORE }, .tidy = gk104_clk_tidy,
{ nv_clk_src_rop , 0x02, NVKM_CLK_DOM_FLAG_CORE }, .domains = {
{ nv_clk_src_mem , 0x03, 0, "memory", 500 }, { nv_clk_src_crystal, 0xff },
{ nv_clk_src_hubk06 , 0x04, NVKM_CLK_DOM_FLAG_CORE }, { nv_clk_src_href , 0xff },
{ nv_clk_src_hubk01 , 0x05 }, { nv_clk_src_gpc , 0x00, NVKM_CLK_DOM_FLAG_CORE, "core", 2000 },
{ nv_clk_src_vdec , 0x06 }, { nv_clk_src_hubk07 , 0x01, NVKM_CLK_DOM_FLAG_CORE },
{ nv_clk_src_daemon , 0x07 }, { nv_clk_src_rop , 0x02, NVKM_CLK_DOM_FLAG_CORE },
{ nv_clk_src_max } { nv_clk_src_mem , 0x03, 0, "memory", 500 },
{ nv_clk_src_hubk06 , 0x04, NVKM_CLK_DOM_FLAG_CORE },
{ nv_clk_src_hubk01 , 0x05 },
{ nv_clk_src_vdec , 0x06 },
{ nv_clk_src_daemon , 0x07 },
{ nv_clk_src_max }
}
}; };
static int int
gk104_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, gk104_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{ {
struct gk104_clk *clk; struct gk104_clk *clk;
int ret;
ret = nvkm_clk_create(parent, engine, oclass, gk104_domain, if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
NULL, 0, true, &clk); return -ENOMEM;
*pobject = nv_object(clk); *pclk = &clk->base;
if (ret)
return ret;
clk->base.read = gk104_clk_read; return nvkm_clk_ctor(&gk104_clk, device, index, true, &clk->base);
clk->base.calc = gk104_clk_calc;
clk->base.prog = gk104_clk_prog;
clk->base.tidy = gk104_clk_tidy;
return 0;
} }
struct nvkm_oclass
gk104_clk_oclass = {
.handle = NV_SUBDEV(CLK, 0xe0),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gk104_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
* Shamelessly ripped off from ChromeOS's gk20a/clk_pllg.c * Shamelessly ripped off from ChromeOS's gk20a/clk_pllg.c
* *
*/ */
#include <subdev/clk.h> #define gk20a_clk(p) container_of((p), struct gk20a_clk, base)
#include "priv.h"
#include <subdev/timer.h> #include <subdev/timer.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -121,7 +123,6 @@ struct gk20a_clk { ...@@ -121,7 +123,6 @@ struct gk20a_clk {
u32 m, n, pl; u32 m, n, pl;
u32 parent_rate; u32 parent_rate;
}; };
#define to_gk20a_clk(base) container_of(base, struct gk20a_clk, base)
static void static void
gk20a_pllg_read_mnp(struct gk20a_clk *clk) gk20a_pllg_read_mnp(struct gk20a_clk *clk)
...@@ -467,13 +468,6 @@ gk20a_pllg_disable(struct gk20a_clk *clk) ...@@ -467,13 +468,6 @@ gk20a_pllg_disable(struct gk20a_clk *clk)
#define GK20A_CLK_GPC_MDIV 1000 #define GK20A_CLK_GPC_MDIV 1000
static struct nvkm_domain
gk20a_domains[] = {
{ nv_clk_src_crystal, 0xff },
{ nv_clk_src_gpc, 0xff, 0, "core", GK20A_CLK_GPC_MDIV },
{ nv_clk_src_max }
};
static struct nvkm_pstate static struct nvkm_pstate
gk20a_pstates[] = { gk20a_pstates[] = {
{ {
...@@ -569,9 +563,9 @@ gk20a_pstates[] = { ...@@ -569,9 +563,9 @@ gk20a_pstates[] = {
}; };
static int static int
gk20a_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) gk20a_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct gk20a_clk *clk = container_of(obj, typeof(*clk), base); struct gk20a_clk *clk = gk20a_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
...@@ -588,54 +582,44 @@ gk20a_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -588,54 +582,44 @@ gk20a_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
} }
static int static int
gk20a_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) gk20a_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct gk20a_clk *clk = container_of(obj, typeof(*clk), base); struct gk20a_clk *clk = gk20a_clk(base);
return gk20a_pllg_calc_mnp(clk, cstate->domain[nv_clk_src_gpc] * return gk20a_pllg_calc_mnp(clk, cstate->domain[nv_clk_src_gpc] *
GK20A_CLK_GPC_MDIV); GK20A_CLK_GPC_MDIV);
} }
static int static int
gk20a_clk_prog(struct nvkm_clk *obj) gk20a_clk_prog(struct nvkm_clk *base)
{ {
struct gk20a_clk *clk = container_of(obj, typeof(*clk), base); struct gk20a_clk *clk = gk20a_clk(base);
return gk20a_pllg_program_mnp(clk); return gk20a_pllg_program_mnp(clk);
} }
static void static void
gk20a_clk_tidy(struct nvkm_clk *obj) gk20a_clk_tidy(struct nvkm_clk *base)
{ {
} }
static int static void
gk20a_clk_fini(struct nvkm_object *object, bool suspend) gk20a_clk_fini(struct nvkm_clk *base)
{ {
struct gk20a_clk *clk = (void *)object; struct gk20a_clk *clk = gk20a_clk(base);
int ret;
ret = nvkm_clk_fini(&clk->base, false);
gk20a_pllg_disable(clk); gk20a_pllg_disable(clk);
return ret;
} }
static int static int
gk20a_clk_init(struct nvkm_object *object) gk20a_clk_init(struct nvkm_clk *base)
{ {
struct gk20a_clk *clk = (void *)object; struct gk20a_clk *clk = gk20a_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
int ret; int ret;
nvkm_mask(device, GPC2CLK_OUT, GPC2CLK_OUT_INIT_MASK, GPC2CLK_OUT_INIT_VAL); nvkm_mask(device, GPC2CLK_OUT, GPC2CLK_OUT_INIT_MASK, GPC2CLK_OUT_INIT_VAL);
ret = nvkm_clk_init(&clk->base);
if (ret)
return ret;
ret = gk20a_clk_prog(&clk->base); ret = gk20a_clk_prog(&clk->base);
if (ret) { if (ret) {
nvkm_error(subdev, "cannot initialize clock\n"); nvkm_error(subdev, "cannot initialize clock\n");
...@@ -645,15 +629,32 @@ gk20a_clk_init(struct nvkm_object *object) ...@@ -645,15 +629,32 @@ gk20a_clk_init(struct nvkm_object *object)
return 0; return 0;
} }
static int static const struct nvkm_clk_func
gk20a_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, gk20a_clk = {
struct nvkm_oclass *oclass, void *data, u32 size, .init = gk20a_clk_init,
struct nvkm_object **pobject) .fini = gk20a_clk_fini,
.read = gk20a_clk_read,
.calc = gk20a_clk_calc,
.prog = gk20a_clk_prog,
.tidy = gk20a_clk_tidy,
.pstates = gk20a_pstates,
.nr_pstates = ARRAY_SIZE(gk20a_pstates),
.domains = {
{ nv_clk_src_crystal, 0xff },
{ nv_clk_src_gpc, 0xff, 0, "core", GK20A_CLK_GPC_MDIV },
{ nv_clk_src_max }
}
};
int
gk20a_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
{ {
struct nvkm_device *device = (void *)parent;
struct gk20a_clk *clk; struct gk20a_clk *clk;
int ret; int ret, i;
int i;
if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
return -ENOMEM;
*pclk = &clk->base;
/* Finish initializing the pstates */ /* Finish initializing the pstates */
for (i = 0; i < ARRAY_SIZE(gk20a_pstates); i++) { for (i = 0; i < ARRAY_SIZE(gk20a_pstates); i++) {
...@@ -661,33 +662,11 @@ gk20a_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -661,33 +662,11 @@ gk20a_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
gk20a_pstates[i].pstate = i + 1; gk20a_pstates[i].pstate = i + 1;
} }
ret = nvkm_clk_create(parent, engine, oclass, gk20a_domains,
gk20a_pstates, ARRAY_SIZE(gk20a_pstates),
true, &clk);
*pobject = nv_object(clk);
if (ret)
return ret;
clk->params = &gk20a_pllg_params; clk->params = &gk20a_pllg_params;
clk->parent_rate = clk_get_rate(device->gpu->clk); clk->parent_rate = clk_get_rate(device->gpu->clk);
ret = nvkm_clk_ctor(&gk20a_clk, device, index, true, &clk->base);
nvkm_info(&clk->base.subdev, "parent clock rate: %d Mhz\n", nvkm_info(&clk->base.subdev, "parent clock rate: %d Mhz\n",
clk->parent_rate / MHZ); clk->parent_rate / MHZ);
return ret;
clk->base.read = gk20a_clk_read;
clk->base.calc = gk20a_clk_calc;
clk->base.prog = gk20a_clk_prog;
clk->base.tidy = gk20a_clk_tidy;
return 0;
} }
struct nvkm_oclass
gk20a_clk_oclass = {
.handle = NV_SUBDEV(CLK, 0xea),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gk20a_clk_ctor,
.dtor = _nvkm_subdev_dtor,
.init = gk20a_clk_init,
.fini = gk20a_clk_fini,
},
};
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Authors: Ben Skeggs * Authors: Ben Skeggs
* Roy Spliet * Roy Spliet
*/ */
#define gt215_clk(p) container_of((p), struct gt215_clk, base)
#include "gt215.h" #include "gt215.h"
#include "pll.h" #include "pll.h"
...@@ -136,9 +137,9 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll) ...@@ -136,9 +137,9 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll)
} }
static int static int
gt215_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) gt215_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct gt215_clk *clk = container_of(obj, typeof(*clk), base); struct gt215_clk *clk = gt215_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
u32 hsrc; u32 hsrc;
...@@ -180,10 +181,10 @@ gt215_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -180,10 +181,10 @@ gt215_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
} }
int int
gt215_clk_info(struct nvkm_clk *obj, int idx, u32 khz, gt215_clk_info(struct nvkm_clk *base, int idx, u32 khz,
struct gt215_clk_info *info) struct gt215_clk_info *info)
{ {
struct gt215_clk *clk = container_of(obj, typeof(*clk), base); struct gt215_clk *clk = gt215_clk(base);
u32 oclk, sclk, sdiv; u32 oclk, sclk, sdiv;
s32 diff; s32 diff;
...@@ -228,10 +229,10 @@ gt215_clk_info(struct nvkm_clk *obj, int idx, u32 khz, ...@@ -228,10 +229,10 @@ gt215_clk_info(struct nvkm_clk *obj, int idx, u32 khz,
} }
int int
gt215_pll_info(struct nvkm_clk *clock, int idx, u32 pll, u32 khz, gt215_pll_info(struct nvkm_clk *base, int idx, u32 pll, u32 khz,
struct gt215_clk_info *info) struct gt215_clk_info *info)
{ {
struct gt215_clk *clk = (void *)clock; struct gt215_clk *clk = gt215_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvbios_pll limits; struct nvbios_pll limits;
int P, N, M, diff; int P, N, M, diff;
...@@ -241,7 +242,7 @@ gt215_pll_info(struct nvkm_clk *clock, int idx, u32 pll, u32 khz, ...@@ -241,7 +242,7 @@ gt215_pll_info(struct nvkm_clk *clock, int idx, u32 pll, u32 khz,
/* If we can get a within [-2, 3) MHz of a divider, we'll disable the /* If we can get a within [-2, 3) MHz of a divider, we'll disable the
* PLL and use the divider instead. */ * PLL and use the divider instead. */
ret = gt215_clk_info(clock, idx, khz, info); ret = gt215_clk_info(&clk->base, idx, khz, info);
diff = khz - ret; diff = khz - ret;
if (!pll || (diff >= -2000 && diff < 3000)) { if (!pll || (diff >= -2000 && diff < 3000)) {
goto out; goto out;
...@@ -252,7 +253,7 @@ gt215_pll_info(struct nvkm_clk *clock, int idx, u32 pll, u32 khz, ...@@ -252,7 +253,7 @@ gt215_pll_info(struct nvkm_clk *clock, int idx, u32 pll, u32 khz,
if (ret) if (ret)
return ret; return ret;
ret = gt215_clk_info(clock, idx - 0x10, limits.refclk, info); ret = gt215_clk_info(&clk->base, idx - 0x10, limits.refclk, info);
if (ret != limits.refclk) if (ret != limits.refclk)
return -EINVAL; return -EINVAL;
...@@ -452,9 +453,9 @@ prog_core(struct gt215_clk *clk, int dom) ...@@ -452,9 +453,9 @@ prog_core(struct gt215_clk *clk, int dom)
} }
static int static int
gt215_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) gt215_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct gt215_clk *clk = container_of(obj, typeof(*clk), base); struct gt215_clk *clk = gt215_clk(base);
struct gt215_clk_info *core = &clk->eng[nv_clk_src_core]; struct gt215_clk_info *core = &clk->eng[nv_clk_src_core];
int ret; int ret;
...@@ -479,9 +480,9 @@ gt215_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) ...@@ -479,9 +480,9 @@ gt215_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate)
} }
static int static int
gt215_clk_prog(struct nvkm_clk *obj) gt215_clk_prog(struct nvkm_clk *base)
{ {
struct gt215_clk *clk = container_of(obj, typeof(*clk), base); struct gt215_clk *clk = gt215_clk(base);
struct gt215_clk_info *core = &clk->eng[nv_clk_src_core]; struct gt215_clk_info *core = &clk->eng[nv_clk_src_core];
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
...@@ -509,51 +510,37 @@ gt215_clk_prog(struct nvkm_clk *obj) ...@@ -509,51 +510,37 @@ gt215_clk_prog(struct nvkm_clk *obj)
} }
static void static void
gt215_clk_tidy(struct nvkm_clk *obj) gt215_clk_tidy(struct nvkm_clk *base)
{ {
} }
static struct nvkm_domain static const struct nvkm_clk_func
gt215_domain[] = { gt215_clk = {
{ nv_clk_src_crystal , 0xff }, .read = gt215_clk_read,
{ nv_clk_src_core , 0x00, 0, "core", 1000 }, .calc = gt215_clk_calc,
{ nv_clk_src_shader , 0x01, 0, "shader", 1000 }, .prog = gt215_clk_prog,
{ nv_clk_src_mem , 0x02, 0, "memory", 1000 }, .tidy = gt215_clk_tidy,
{ nv_clk_src_vdec , 0x03 }, .domains = {
{ nv_clk_src_disp , 0x04 }, { nv_clk_src_crystal , 0xff },
{ nv_clk_src_host , 0x05 }, { nv_clk_src_core , 0x00, 0, "core", 1000 },
{ nv_clk_src_core_intm, 0x06 }, { nv_clk_src_shader , 0x01, 0, "shader", 1000 },
{ nv_clk_src_max } { nv_clk_src_mem , 0x02, 0, "memory", 1000 },
{ nv_clk_src_vdec , 0x03 },
{ nv_clk_src_disp , 0x04 },
{ nv_clk_src_host , 0x05 },
{ nv_clk_src_core_intm, 0x06 },
{ nv_clk_src_max }
}
}; };
static int int
gt215_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, gt215_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{ {
struct gt215_clk *clk; struct gt215_clk *clk;
int ret;
ret = nvkm_clk_create(parent, engine, oclass, gt215_domain, if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
NULL, 0, true, &clk); return -ENOMEM;
*pobject = nv_object(clk); *pclk = &clk->base;
if (ret)
return ret;
clk->base.read = gt215_clk_read; return nvkm_clk_ctor(&gt215_clk, device, index, true, &clk->base);
clk->base.calc = gt215_clk_calc;
clk->base.prog = gt215_clk_prog;
clk->base.tidy = gt215_clk_tidy;
return 0;
} }
struct nvkm_oclass
gt215_clk_oclass = {
.handle = NV_SUBDEV(CLK, 0xa3),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = gt215_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
#ifndef __NVKM_CLK_NVA3_H__ #ifndef __NVKM_CLK_NVA3_H__
#define __NVKM_CLK_NVA3_H__ #define __NVKM_CLK_NVA3_H__
#include <subdev/clk.h> #include "priv.h"
struct gt215_clk_info { struct gt215_clk_info {
u32 clk; u32 clk;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#define mcp77_clk(p) container_of((p), struct mcp77_clk, base)
#include "gt215.h" #include "gt215.h"
#include "pll.h" #include "pll.h"
...@@ -50,7 +51,7 @@ read_pll(struct mcp77_clk *clk, u32 base) ...@@ -50,7 +51,7 @@ read_pll(struct mcp77_clk *clk, u32 base)
struct nvkm_device *device = clk->base.subdev.device; struct nvkm_device *device = clk->base.subdev.device;
u32 ctrl = nvkm_rd32(device, base + 0); u32 ctrl = nvkm_rd32(device, base + 0);
u32 coef = nvkm_rd32(device, base + 4); u32 coef = nvkm_rd32(device, base + 4);
u32 ref = clk->base.read(&clk->base, nv_clk_src_href); u32 ref = nvkm_clk_read(&clk->base, nv_clk_src_href);
u32 post_div = 0; u32 post_div = 0;
u32 clock = 0; u32 clock = 0;
int N1, M1; int N1, M1;
...@@ -77,9 +78,9 @@ read_pll(struct mcp77_clk *clk, u32 base) ...@@ -77,9 +78,9 @@ read_pll(struct mcp77_clk *clk, u32 base)
} }
static int static int
mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) mcp77_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct mcp77_clk *clk = container_of(obj, typeof(*clk), base); struct mcp77_clk *clk = mcp77_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
u32 mast = nvkm_rd32(device, 0x00c054); u32 mast = nvkm_rd32(device, 0x00c054);
...@@ -91,38 +92,38 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -91,38 +92,38 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
case nv_clk_src_href: case nv_clk_src_href:
return 100000; /* PCIE reference clock */ return 100000; /* PCIE reference clock */
case nv_clk_src_hclkm4: case nv_clk_src_hclkm4:
return clk->base.read(&clk->base, nv_clk_src_href) * 4; return nvkm_clk_read(&clk->base, nv_clk_src_href) * 4;
case nv_clk_src_hclkm2d3: case nv_clk_src_hclkm2d3:
return clk->base.read(&clk->base, nv_clk_src_href) * 2 / 3; return nvkm_clk_read(&clk->base, nv_clk_src_href) * 2 / 3;
case nv_clk_src_host: case nv_clk_src_host:
switch (mast & 0x000c0000) { switch (mast & 0x000c0000) {
case 0x00000000: return clk->base.read(&clk->base, nv_clk_src_hclkm2d3); case 0x00000000: return nvkm_clk_read(&clk->base, nv_clk_src_hclkm2d3);
case 0x00040000: break; case 0x00040000: break;
case 0x00080000: return clk->base.read(&clk->base, nv_clk_src_hclkm4); case 0x00080000: return nvkm_clk_read(&clk->base, nv_clk_src_hclkm4);
case 0x000c0000: return clk->base.read(&clk->base, nv_clk_src_cclk); case 0x000c0000: return nvkm_clk_read(&clk->base, nv_clk_src_cclk);
} }
break; break;
case nv_clk_src_core: case nv_clk_src_core:
P = (nvkm_rd32(device, 0x004028) & 0x00070000) >> 16; P = (nvkm_rd32(device, 0x004028) & 0x00070000) >> 16;
switch (mast & 0x00000003) { switch (mast & 0x00000003) {
case 0x00000000: return clk->base.read(&clk->base, nv_clk_src_crystal) >> P; case 0x00000000: return nvkm_clk_read(&clk->base, nv_clk_src_crystal) >> P;
case 0x00000001: return 0; case 0x00000001: return 0;
case 0x00000002: return clk->base.read(&clk->base, nv_clk_src_hclkm4) >> P; case 0x00000002: return nvkm_clk_read(&clk->base, nv_clk_src_hclkm4) >> P;
case 0x00000003: return read_pll(clk, 0x004028) >> P; case 0x00000003: return read_pll(clk, 0x004028) >> P;
} }
break; break;
case nv_clk_src_cclk: case nv_clk_src_cclk:
if ((mast & 0x03000000) != 0x03000000) if ((mast & 0x03000000) != 0x03000000)
return clk->base.read(&clk->base, nv_clk_src_core); return nvkm_clk_read(&clk->base, nv_clk_src_core);
if ((mast & 0x00000200) == 0x00000000) if ((mast & 0x00000200) == 0x00000000)
return clk->base.read(&clk->base, nv_clk_src_core); return nvkm_clk_read(&clk->base, nv_clk_src_core);
switch (mast & 0x00000c00) { switch (mast & 0x00000c00) {
case 0x00000000: return clk->base.read(&clk->base, nv_clk_src_href); case 0x00000000: return nvkm_clk_read(&clk->base, nv_clk_src_href);
case 0x00000400: return clk->base.read(&clk->base, nv_clk_src_hclkm4); case 0x00000400: return nvkm_clk_read(&clk->base, nv_clk_src_hclkm4);
case 0x00000800: return clk->base.read(&clk->base, nv_clk_src_hclkm2d3); case 0x00000800: return nvkm_clk_read(&clk->base, nv_clk_src_hclkm2d3);
default: return 0; default: return 0;
} }
case nv_clk_src_shader: case nv_clk_src_shader:
...@@ -130,8 +131,8 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -130,8 +131,8 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
switch (mast & 0x00000030) { switch (mast & 0x00000030) {
case 0x00000000: case 0x00000000:
if (mast & 0x00000040) if (mast & 0x00000040)
return clk->base.read(&clk->base, nv_clk_src_href) >> P; return nvkm_clk_read(&clk->base, nv_clk_src_href) >> P;
return clk->base.read(&clk->base, nv_clk_src_crystal) >> P; return nvkm_clk_read(&clk->base, nv_clk_src_crystal) >> P;
case 0x00000010: break; case 0x00000010: break;
case 0x00000020: return read_pll(clk, 0x004028) >> P; case 0x00000020: return read_pll(clk, 0x004028) >> P;
case 0x00000030: return read_pll(clk, 0x004020) >> P; case 0x00000030: return read_pll(clk, 0x004020) >> P;
...@@ -145,7 +146,7 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) ...@@ -145,7 +146,7 @@ mcp77_clk_read(struct nvkm_clk *obj, enum nv_clk_src src)
switch (mast & 0x00400000) { switch (mast & 0x00400000) {
case 0x00400000: case 0x00400000:
return clk->base.read(&clk->base, nv_clk_src_core) >> P; return nvkm_clk_read(&clk->base, nv_clk_src_core) >> P;
break; break;
default: default:
return 500000 >> P; return 500000 >> P;
...@@ -173,7 +174,7 @@ calc_pll(struct mcp77_clk *clk, u32 reg, ...@@ -173,7 +174,7 @@ calc_pll(struct mcp77_clk *clk, u32 reg,
return 0; return 0;
pll.vco2.max_freq = 0; pll.vco2.max_freq = 0;
pll.refclk = clk->base.read(&clk->base, nv_clk_src_href); pll.refclk = nvkm_clk_read(&clk->base, nv_clk_src_href);
if (!pll.refclk) if (!pll.refclk)
return 0; return 0;
...@@ -199,9 +200,9 @@ calc_P(u32 src, u32 target, int *div) ...@@ -199,9 +200,9 @@ calc_P(u32 src, u32 target, int *div)
} }
static int static int
mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) mcp77_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct mcp77_clk *clk = container_of(obj, typeof(*clk), base); struct mcp77_clk *clk = mcp77_clk(base);
const int shader = cstate->domain[nv_clk_src_shader]; const int shader = cstate->domain[nv_clk_src_shader];
const int core = cstate->domain[nv_clk_src_core]; const int core = cstate->domain[nv_clk_src_core];
const int vdec = cstate->domain[nv_clk_src_vdec]; const int vdec = cstate->domain[nv_clk_src_vdec];
...@@ -211,8 +212,8 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) ...@@ -211,8 +212,8 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate)
int divs = 0; int divs = 0;
/* cclk: find suitable source, disable PLL if we can */ /* cclk: find suitable source, disable PLL if we can */
if (core < clk->base.read(&clk->base, nv_clk_src_hclkm4)) if (core < nvkm_clk_read(&clk->base, nv_clk_src_hclkm4))
out = calc_P(clk->base.read(&clk->base, nv_clk_src_hclkm4), core, &divs); out = calc_P(nvkm_clk_read(&clk->base, nv_clk_src_hclkm4), core, &divs);
/* Calculate clock * 2, so shader clock can use it too */ /* Calculate clock * 2, so shader clock can use it too */
clock = calc_pll(clk, 0x4028, (core << 1), &N, &M, &P1); clock = calc_pll(clk, 0x4028, (core << 1), &N, &M, &P1);
...@@ -238,7 +239,7 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) ...@@ -238,7 +239,7 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate)
/* sclk: nvpll + divisor, href or spll */ /* sclk: nvpll + divisor, href or spll */
out = 0; out = 0;
if (shader == clk->base.read(&clk->base, nv_clk_src_href)) { if (shader == nvkm_clk_read(&clk->base, nv_clk_src_href)) {
clk->ssrc = nv_clk_src_href; clk->ssrc = nv_clk_src_href;
} else { } else {
clock = calc_pll(clk, 0x4020, shader, &N, &M, &P1); clock = calc_pll(clk, 0x4020, shader, &N, &M, &P1);
...@@ -295,9 +296,9 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) ...@@ -295,9 +296,9 @@ mcp77_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate)
} }
static int static int
mcp77_clk_prog(struct nvkm_clk *obj) mcp77_clk_prog(struct nvkm_clk *base)
{ {
struct mcp77_clk *clk = container_of(obj, typeof(*clk), base); struct mcp77_clk *clk = mcp77_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
u32 pllmask = 0, mast; u32 pllmask = 0, mast;
...@@ -389,48 +390,34 @@ mcp77_clk_prog(struct nvkm_clk *obj) ...@@ -389,48 +390,34 @@ mcp77_clk_prog(struct nvkm_clk *obj)
} }
static void static void
mcp77_clk_tidy(struct nvkm_clk *obj) mcp77_clk_tidy(struct nvkm_clk *base)
{ {
} }
static struct nvkm_domain static const struct nvkm_clk_func
mcp77_domains[] = { mcp77_clk = {
{ nv_clk_src_crystal, 0xff }, .read = mcp77_clk_read,
{ nv_clk_src_href , 0xff }, .calc = mcp77_clk_calc,
{ nv_clk_src_core , 0xff, 0, "core", 1000 }, .prog = mcp77_clk_prog,
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 }, .tidy = mcp77_clk_tidy,
{ nv_clk_src_vdec , 0xff, 0, "vdec", 1000 }, .domains = {
{ nv_clk_src_max } { nv_clk_src_crystal, 0xff },
{ nv_clk_src_href , 0xff },
{ nv_clk_src_core , 0xff, 0, "core", 1000 },
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 },
{ nv_clk_src_vdec , 0xff, 0, "vdec", 1000 },
{ nv_clk_src_max }
}
}; };
static int int
mcp77_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, mcp77_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{ {
struct mcp77_clk *clk; struct mcp77_clk *clk;
int ret;
ret = nvkm_clk_create(parent, engine, oclass, mcp77_domains, if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
NULL, 0, true, &clk); return -ENOMEM;
*pobject = nv_object(clk); *pclk = &clk->base;
if (ret)
return ret;
clk->base.read = mcp77_clk_read; return nvkm_clk_ctor(&mcp77_clk, device, index, true, &clk->base);
clk->base.calc = mcp77_clk_calc;
clk->base.prog = mcp77_clk_prog;
clk->base.tidy = mcp77_clk_tidy;
return 0;
} }
struct nvkm_oclass *
mcp77_clk_oclass = &(struct nvkm_oclass) {
.handle = NV_SUBDEV(CLK, 0xaa),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = mcp77_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/clk.h> #include "priv.h"
#include "pll.h" #include "pll.h"
#include <subdev/bios.h> #include <subdev/bios.h>
...@@ -33,7 +33,7 @@ nv04_clk_pll_calc(struct nvkm_clk *clock, struct nvbios_pll *info, ...@@ -33,7 +33,7 @@ nv04_clk_pll_calc(struct nvkm_clk *clock, struct nvbios_pll *info,
int clk, struct nvkm_pll_vals *pv) int clk, struct nvkm_pll_vals *pv)
{ {
int N1, M1, N2, M2, P; int N1, M1, N2, M2, P;
int ret = nv04_pll_calc(nv_subdev(clock), info, clk, &N1, &M1, &N2, &M2, &P); int ret = nv04_pll_calc(&clock->subdev, info, clk, &N1, &M1, &N2, &M2, &P);
if (ret) { if (ret) {
pv->refclk = info->refclk; pv->refclk = info->refclk;
pv->N1 = N1; pv->N1 = N1;
...@@ -64,37 +64,20 @@ nv04_clk_pll_prog(struct nvkm_clk *clk, u32 reg1, struct nvkm_pll_vals *pv) ...@@ -64,37 +64,20 @@ nv04_clk_pll_prog(struct nvkm_clk *clk, u32 reg1, struct nvkm_pll_vals *pv)
return 0; return 0;
} }
static struct nvkm_domain static const struct nvkm_clk_func
nv04_domain[] = { nv04_clk = {
{ nv_clk_src_max } .domains = {
{ nv_clk_src_max }
}
}; };
static int int
nv04_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, nv04_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{ {
struct nvkm_clk *clk; int ret = nvkm_clk_new_(&nv04_clk, device, index, false, pclk);
int ret; if (ret == 0) {
(*pclk)->pll_calc = nv04_clk_pll_calc;
ret = nvkm_clk_create(parent, engine, oclass, nv04_domain, (*pclk)->pll_prog = nv04_clk_pll_prog;
NULL, 0, false, &clk); }
*pobject = nv_object(clk); return ret;
if (ret)
return ret;
clk->pll_calc = nv04_clk_pll_calc;
clk->pll_prog = nv04_clk_pll_prog;
return 0;
} }
struct nvkm_oclass
nv04_clk_oclass = {
.handle = NV_SUBDEV(CLK, 0x04),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv04_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/clk.h> #define nv40_clk(p) container_of((p), struct nv40_clk, base)
#include "priv.h"
#include "pll.h" #include "pll.h"
#include <subdev/bios.h> #include <subdev/bios.h>
...@@ -35,16 +36,6 @@ struct nv40_clk { ...@@ -35,16 +36,6 @@ struct nv40_clk {
u32 spll; u32 spll;
}; };
static struct nvkm_domain
nv40_domain[] = {
{ nv_clk_src_crystal, 0xff },
{ nv_clk_src_href , 0xff },
{ nv_clk_src_core , 0xff, 0, "core", 1000 },
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 },
{ nv_clk_src_mem , 0xff, 0, "memory", 1000 },
{ nv_clk_src_max }
};
static u32 static u32
read_pll_1(struct nv40_clk *clk, u32 reg) read_pll_1(struct nv40_clk *clk, u32 reg)
{ {
...@@ -103,9 +94,9 @@ read_clk(struct nv40_clk *clk, u32 src) ...@@ -103,9 +94,9 @@ read_clk(struct nv40_clk *clk, u32 src)
} }
static int static int
nv40_clk_read(struct nvkm_clk *obj, enum nv_clk_src src) nv40_clk_read(struct nvkm_clk *base, enum nv_clk_src src)
{ {
struct nv40_clk *clk = container_of(obj, typeof(*clk), base); struct nv40_clk *clk = nv40_clk(base);
struct nvkm_subdev *subdev = &clk->base.subdev; struct nvkm_subdev *subdev = &clk->base.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
u32 mast = nvkm_rd32(device, 0x00c040); u32 mast = nvkm_rd32(device, 0x00c040);
...@@ -152,9 +143,9 @@ nv40_clk_calc_pll(struct nv40_clk *clk, u32 reg, u32 khz, ...@@ -152,9 +143,9 @@ nv40_clk_calc_pll(struct nv40_clk *clk, u32 reg, u32 khz,
} }
static int static int
nv40_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) nv40_clk_calc(struct nvkm_clk *base, struct nvkm_cstate *cstate)
{ {
struct nv40_clk *clk = container_of(obj, typeof(*clk), base); struct nv40_clk *clk = nv40_clk(base);
int gclk = cstate->domain[nv_clk_src_core]; int gclk = cstate->domain[nv_clk_src_core];
int sclk = cstate->domain[nv_clk_src_shader]; int sclk = cstate->domain[nv_clk_src_shader];
int N1, M1, N2, M2, log2P; int N1, M1, N2, M2, log2P;
...@@ -192,9 +183,9 @@ nv40_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate) ...@@ -192,9 +183,9 @@ nv40_clk_calc(struct nvkm_clk *obj, struct nvkm_cstate *cstate)
} }
static int static int
nv40_clk_prog(struct nvkm_clk *obj) nv40_clk_prog(struct nvkm_clk *base)
{ {
struct nv40_clk *clk = container_of(obj, typeof(*clk), base); struct nv40_clk *clk = nv40_clk(base);
struct nvkm_device *device = clk->base.subdev.device; struct nvkm_device *device = clk->base.subdev.device;
nvkm_mask(device, 0x00c040, 0x00000333, 0x00000000); nvkm_mask(device, 0x00c040, 0x00000333, 0x00000000);
nvkm_wr32(device, 0x004004, clk->npll_coef); nvkm_wr32(device, 0x004004, clk->npll_coef);
...@@ -210,36 +201,32 @@ nv40_clk_tidy(struct nvkm_clk *obj) ...@@ -210,36 +201,32 @@ nv40_clk_tidy(struct nvkm_clk *obj)
{ {
} }
static int static const struct nvkm_clk_func
nv40_clk_ctor(struct nvkm_object *parent, struct nvkm_object *engine, nv40_clk = {
struct nvkm_oclass *oclass, void *data, u32 size, .read = nv40_clk_read,
struct nvkm_object **pobject) .calc = nv40_clk_calc,
.prog = nv40_clk_prog,
.tidy = nv40_clk_tidy,
.domains = {
{ nv_clk_src_crystal, 0xff },
{ nv_clk_src_href , 0xff },
{ nv_clk_src_core , 0xff, 0, "core", 1000 },
{ nv_clk_src_shader , 0xff, 0, "shader", 1000 },
{ nv_clk_src_mem , 0xff, 0, "memory", 1000 },
{ nv_clk_src_max }
}
};
int
nv40_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk)
{ {
struct nv40_clk *clk; struct nv40_clk *clk;
int ret;
ret = nvkm_clk_create(parent, engine, oclass, nv40_domain,
NULL, 0, true, &clk);
*pobject = nv_object(clk);
if (ret)
return ret;
if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
return -ENOMEM;
clk->base.pll_calc = nv04_clk_pll_calc; clk->base.pll_calc = nv04_clk_pll_calc;
clk->base.pll_prog = nv04_clk_pll_prog; clk->base.pll_prog = nv04_clk_pll_prog;
clk->base.read = nv40_clk_read; *pclk = &clk->base;
clk->base.calc = nv40_clk_calc;
clk->base.prog = nv40_clk_prog;
clk->base.tidy = nv40_clk_tidy;
return 0;
}
struct nvkm_oclass return nvkm_clk_ctor(&nv40_clk, device, index, true, &clk->base);
nv40_clk_oclass = { }
.handle = NV_SUBDEV(CLK, 0x40),
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv40_clk_ctor,
.dtor = _nvkm_clk_dtor,
.init = _nvkm_clk_init,
.fini = _nvkm_clk_fini,
},
};
#ifndef __NVKM_CLK_NV50_H__ #ifndef __NV50_CLK_H__
#define __NVKM_CLK_NV50_H__ #define __NV50_CLK_H__
#define nv50_clk(p) container_of((p), struct nv50_clk, base)
#include "priv.h"
#include <subdev/bus/hwsq.h> #include <subdev/bus/hwsq.h>
#include <subdev/clk.h>
struct nv50_clk_hwsq { struct nv50_clk_hwsq {
struct hwsq base; struct hwsq base;
...@@ -17,12 +19,10 @@ struct nv50_clk { ...@@ -17,12 +19,10 @@ struct nv50_clk {
struct nv50_clk_hwsq hwsq; struct nv50_clk_hwsq hwsq;
}; };
int nv50_clk_ctor(struct nvkm_object *, struct nvkm_object *, int nv50_clk_new_(const struct nvkm_clk_func *, struct nvkm_device *, int,
struct nvkm_oclass *, void *, u32, bool, struct nvkm_clk **);
struct nvkm_object **); int nv50_clk_read(struct nvkm_clk *, enum nv_clk_src);
int nv50_clk_calc(struct nvkm_clk *, struct nvkm_cstate *);
struct nv50_clk_oclass { int nv50_clk_prog(struct nvkm_clk *);
struct nvkm_oclass base; void nv50_clk_tidy(struct nvkm_clk *);
struct nvkm_domain *domains;
};
#endif #endif
#ifndef __NVKM_CLK_PRIV_H__
#define __NVKM_CLK_PRIV_H__
#define nvkm_clk(p) container_of((p), struct nvkm_clk, subdev)
#include <subdev/clk.h>
struct nvkm_clk_func {
int (*init)(struct nvkm_clk *);
void (*fini)(struct nvkm_clk *);
int (*read)(struct nvkm_clk *, enum nv_clk_src);
int (*calc)(struct nvkm_clk *, struct nvkm_cstate *);
int (*prog)(struct nvkm_clk *);
void (*tidy)(struct nvkm_clk *);
struct nvkm_pstate *pstates;
int nr_pstates;
struct nvkm_domain domains[];
};
int nvkm_clk_ctor(const struct nvkm_clk_func *, struct nvkm_device *, int,
bool allow_reclock, struct nvkm_clk *);
int nvkm_clk_new_(const struct nvkm_clk_func *, struct nvkm_device *, int,
bool allow_reclock, struct nvkm_clk **);
int nv04_clk_pll_calc(struct nvkm_clk *, struct nvbios_pll *, int clk,
struct nvkm_pll_vals *);
int nv04_clk_pll_prog(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *);
#endif
...@@ -187,9 +187,9 @@ gf100_ram_calc(struct nvkm_ram *base, u32 freq) ...@@ -187,9 +187,9 @@ gf100_ram_calc(struct nvkm_ram *base, u32 freq)
/* determine target mclk configuration */ /* determine target mclk configuration */
if (!(ram_rd32(fuc, 0x137300) & 0x00000100)) if (!(ram_rd32(fuc, 0x137300) & 0x00000100))
ref = clk->read(clk, nv_clk_src_sppll0); ref = nvkm_clk_read(clk, nv_clk_src_sppll0);
else else
ref = clk->read(clk, nv_clk_src_sppll1); ref = nvkm_clk_read(clk, nv_clk_src_sppll1);
div = max(min((ref * 2) / freq, (u32)65), (u32)2) - 2; div = max(min((ref * 2) / freq, (u32)65), (u32)2) - 2;
out = (ref * 2) / (div + 2); out = (ref * 2) / (div + 2);
mode = freq != out; mode = freq != out;
......
...@@ -1032,7 +1032,8 @@ gk104_ram_calc(struct nvkm_ram *base, u32 freq) ...@@ -1032,7 +1032,8 @@ gk104_ram_calc(struct nvkm_ram *base, u32 freq)
int ret; int ret;
if (ram->base.next == NULL) { if (ram->base.next == NULL) {
ret = gk104_ram_calc_data(ram, clk->read(clk, nv_clk_src_mem), ret = gk104_ram_calc_data(ram,
nvkm_clk_read(clk, nv_clk_src_mem),
&ram->base.former); &ram->base.former);
if (ret) if (ret)
return ret; return ret;
......
...@@ -186,7 +186,7 @@ gt215_link_train(struct gt215_ram *ram) ...@@ -186,7 +186,7 @@ gt215_link_train(struct gt215_ram *ram)
return -ENOENT; return -ENOENT;
} }
clk_current = clk->read(clk, nv_clk_src_mem); clk_current = nvkm_clk_read(clk, nv_clk_src_mem);
ret = gt215_clk_pre(clk, f); ret = gt215_clk_pre(clk, f);
if (ret) if (ret)
......
...@@ -50,7 +50,7 @@ struct gk20a_pmu_dvfs_dev_status { ...@@ -50,7 +50,7 @@ struct gk20a_pmu_dvfs_dev_status {
static int static int
gk20a_pmu_dvfs_target(struct gk20a_pmu *pmu, int *state) gk20a_pmu_dvfs_target(struct gk20a_pmu *pmu, int *state)
{ {
struct nvkm_clk *clk = nvkm_clk(pmu); struct nvkm_clk *clk = pmu->base.subdev.device->clk;
return nvkm_clk_astate(clk, *state, 0, false); return nvkm_clk_astate(clk, *state, 0, false);
} }
...@@ -58,7 +58,7 @@ gk20a_pmu_dvfs_target(struct gk20a_pmu *pmu, int *state) ...@@ -58,7 +58,7 @@ gk20a_pmu_dvfs_target(struct gk20a_pmu *pmu, int *state)
static int static int
gk20a_pmu_dvfs_get_cur_state(struct gk20a_pmu *pmu, int *state) gk20a_pmu_dvfs_get_cur_state(struct gk20a_pmu *pmu, int *state)
{ {
struct nvkm_clk *clk = nvkm_clk(pmu); struct nvkm_clk *clk = pmu->base.subdev.device->clk;
*state = clk->pstate; *state = clk->pstate;
return 0; return 0;
...@@ -69,7 +69,7 @@ gk20a_pmu_dvfs_get_target_state(struct gk20a_pmu *pmu, ...@@ -69,7 +69,7 @@ gk20a_pmu_dvfs_get_target_state(struct gk20a_pmu *pmu,
int *state, int load) int *state, int load)
{ {
struct gk20a_pmu_dvfs_data *data = pmu->data; struct gk20a_pmu_dvfs_data *data = pmu->data;
struct nvkm_clk *clk = nvkm_clk(pmu); struct nvkm_clk *clk = pmu->base.subdev.device->clk;
int cur_level, level; int cur_level, level;
/* For GK20A, the performance level is directly mapped to pstate */ /* For GK20A, the performance level is directly mapped to pstate */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment